Skip to content

Commit 85403cd

Browse files
committed
QL: Fix up parent-child relation in tree
1 parent cb211f8 commit 85403cd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ql/ql/src/codeql_ql/ast/Ast.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class AstNode extends TAstNode {
7979

8080
/** Gets an annotation of this AST node. */
8181
Annotation getAnAnnotation() {
82+
not this instanceof Annotation and // avoid cyclic parent-child relationship
8283
toQL(this).getParent() = pragma[only_bind_out](toQL(result)).getParent()
8384
}
8485

@@ -125,6 +126,9 @@ class TopLevel extends TTopLevel, AstNode {
125126
/** Gets a `newtype` defined at the top-level of this module. */
126127
NewType getANewType() { result = this.getAMember() }
127128

129+
/** Gets a `select` clause in the top-level of this module. */
130+
Select getASelect() { result = this.getAMember() }
131+
128132
override ModuleMember getAChild(string pred) {
129133
pred = directMember("getAnImport") and result = this.getAnImport()
130134
or
@@ -137,6 +141,8 @@ class TopLevel extends TTopLevel, AstNode {
137141
pred = directMember("getANewType") and result = this.getANewType()
138142
or
139143
pred = directMember("getQLDoc") and result = this.getQLDoc()
144+
or
145+
pred = directMember("getASelect") and result = this.getASelect()
140146
}
141147

142148
QLDoc getQLDocFor(ModuleMember m) {

0 commit comments

Comments
 (0)