@@ -100,40 +100,6 @@ private string qlClass(AstNode el) {
100100 result = "[" + concat ( el .getAPrimaryQlClass ( ) , ", " ) + "] "
101101}
102102
103- /**
104- * Gets a child with the given index and of the given kind, if one exists.
105- * Note that a given parent can have multiple children with the same index but differing kind.
106- */
107- private AstNode getChildOfKind ( AstNode parent , string kind , int i ) {
108- kind = "expr" and result = parent .( ExprParent ) .getChildExpr ( i )
109- or
110- kind = "gomodexpr" and result = parent .( GoModExprParent ) .getChildGoModExpr ( i )
111- or
112- kind = "stmt" and result = parent .( StmtParent ) .getChildStmt ( i )
113- or
114- kind = "decl" and result = parent .( DeclParent ) .getDecl ( i )
115- or
116- kind = "spec" and result = parent .( GenDecl ) .getSpec ( i )
117- or
118- kind = "field" and result = parent .( FieldParent ) .getField ( i )
119- or
120- kind = "commentgroup" and result = parent .( File ) .getCommentGroup ( i )
121- or
122- kind = "comment" and result = parent .( CommentGroup ) .getComment ( i )
123- }
124-
125- /**
126- * Get an AstNode child, ordered by child kind and then by index
127- */
128- private AstNode getUniquelyNumberedChild ( AstNode node , int index ) {
129- result =
130- rank [ index + 1 ] ( AstNode child , string kind , int i |
131- child = getChildOfKind ( node , kind , i )
132- |
133- child order by kind , i
134- )
135- }
136-
137103/**
138104 * A graph node representing a real AST node.
139105 */
@@ -147,7 +113,7 @@ class BaseAstNode extends PrintAstNode, TAstNode {
147113 // nodes have multiple different types of child (e.g. a File has a
148114 // child expression, the package name, and child declarations whose
149115 // indices may clash), so we renumber them:
150- result = TAstNode ( getUniquelyNumberedChild ( ast , childIndex ) )
116+ result = TAstNode ( ast . getUniquelyNumberedChild ( childIndex ) )
151117 }
152118
153119 override string toString ( ) { result = qlClass ( ast ) + ast }
0 commit comments