File tree Expand file tree Collapse file tree
test/kotlin/library-tests/generics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,6 +244,21 @@ class ExprStmtNode extends ElementNode {
244244 }
245245}
246246
247+ /**
248+ * A node representing a `KtInitializerAssignExpr`.
249+ */
250+ class KtInitializerNode extends ExprStmtNode {
251+ KtInitializerNode ( ) { element instanceof KtInitializerAssignExpr }
252+
253+ override PrintAstNode getChild ( int childIndex ) {
254+ // Remove the RHS of the initializer, because otherwise
255+ // it appears as both the initializer's child and the
256+ // initialize of the related field, producing a DAG not
257+ // a tree and consequently unreadable output.
258+ result = super .getChild ( childIndex ) and childIndex = 0
259+ }
260+ }
261+
247262/**
248263 * Holds if the given expression is part of an annotation.
249264 */
Original file line number Diff line number Diff line change @@ -86,16 +86,16 @@ generics.kt:
8686# 13| 0: [SuperConstructorInvocationStmt] super(...)
8787# 13| 1: [BlockStmt] { ... }
8888# 13| 0: [ExprStmt] <Expr>;
89- # 13| 0: [AssignExpr ] ...=...
89+ # 13| 0: [KtInitializerAssignExpr ] ...=...
9090# 13| 0: [VarAccess] t
91- # 13| 1: [VarAccess] t
9291# 13| 2: [Method] getT
9392# 13| 5: [BlockStmt] { ... }
9493# 13| 0: [ReturnStmt] return ...
9594# 13| 0: [VarAccess] this.t
9695# 13| -1: [ThisAccess] this
9796# 13| 2: [FieldDeclaration] T t;
9897# 13| -1: [TypeAccess] T
98+ # 13| 0: [VarAccess] t
9999# 14| 4: [Method] f1
100100#-----| 4: (Parameters)
101101# 14| 0: [Parameter] t
You can’t perform that action at this time.
0 commit comments