File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class AstNode extends TAstNode {
4949 /**
5050 * Gets the parent in the AST for this node.
5151 */
52+ cached
5253 AstNode getParent ( ) { result .getAChild ( _) = this }
5354
5455 /**
@@ -74,12 +75,14 @@ class AstNode extends TAstNode {
7475 predicate hasAnnotation ( string name ) { this .getAnAnnotation ( ) .getName ( ) = name }
7576
7677 /** Gets an annotation of this AST node. */
77- Annotation getAnAnnotation ( ) { toQL ( this ) .getParent ( ) = toQL ( result ) .getParent ( ) }
78+ Annotation getAnAnnotation ( ) {
79+ toQL ( this ) .getParent ( ) = pragma [ only_bind_out ] ( toQL ( result ) ) .getParent ( )
80+ }
7881
7982 /**
8083 * Gets the predicate that contains this AST node.
8184 */
82- pragma [ noinline ]
85+ cached
8386 Predicate getEnclosingPredicate ( ) { this = getANodeInPredicate ( result ) }
8487}
8588
@@ -2231,6 +2234,8 @@ class Annotation extends TAnnotation, AstNode {
22312234 /** Gets the node corresponding to the field `name`. */
22322235 string getName ( ) { result = annot .getName ( ) .getValue ( ) }
22332236
2237+ override AstNode getParent ( ) { result = AstNode .super .getParent ( ) }
2238+
22342239 override AstNode getAChild ( string pred ) {
22352240 result = super .getAChild ( pred )
22362241 or
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ private QL::AstNode toGenerateYAML(AST::AstNode n) {
126126/**
127127 * Gets the underlying TreeSitter entity for a given AST node.
128128 */
129+ cached
129130QL:: AstNode toQL ( AST:: AstNode n ) {
130131 result = toQLExpr ( n )
131132 or
You can’t perform that action at this time.
0 commit comments