QL: Fix up parent-child relation in tree

This commit is contained in:
Asger Feldthaus
2022-04-09 07:51:52 +02:00
parent cb211f8844
commit 85403cd4de

View File

@@ -79,6 +79,7 @@ class AstNode extends TAstNode {
/** Gets an annotation of this AST node. */
Annotation getAnAnnotation() {
not this instanceof Annotation and // avoid cyclic parent-child relationship
toQL(this).getParent() = pragma[only_bind_out](toQL(result)).getParent()
}
@@ -125,6 +126,9 @@ class TopLevel extends TTopLevel, AstNode {
/** Gets a `newtype` defined at the top-level of this module. */
NewType getANewType() { result = this.getAMember() }
/** Gets a `select` clause in the top-level of this module. */
Select getASelect() { result = this.getAMember() }
override ModuleMember getAChild(string pred) {
pred = directMember("getAnImport") and result = this.getAnImport()
or
@@ -137,6 +141,8 @@ class TopLevel extends TTopLevel, AstNode {
pred = directMember("getANewType") and result = this.getANewType()
or
pred = directMember("getQLDoc") and result = this.getQLDoc()
or
pred = directMember("getASelect") and result = this.getASelect()
}
QLDoc getQLDocFor(ModuleMember m) {