@@ -118,7 +118,7 @@ private class ErbDirectiveFile extends File {
118118
119119 /** Gets a statement in this file. */
120120 pragma [ nomagic]
121- Stmt getAStmt ( int startLine , int startColumn ) {
121+ AstNode getAnAstNode ( int startLine , int startColumn ) {
122122 exists ( Location loc |
123123 result .getLocation ( ) = loc and
124124 loc .getFile ( ) = this and
@@ -142,13 +142,13 @@ class ErbDirective extends TDirectiveNode, ErbAstNode {
142142 )
143143 }
144144
145- private predicate containsStmtStart ( Stmt s ) {
145+ private predicate containsAstNodeStart ( AstNode s ) {
146146 // `Toplevel` statements are not contained within individual directives,
147147 // though their start location may appear within a directive location
148148 not s instanceof Toplevel and
149149 exists ( ErbDirectiveFile file , int startLine , int startColumn |
150150 this .spans ( file , startLine ) and
151- s = file .getAStmt ( startLine , startColumn ) and
151+ s = file .getAnAstNode ( startLine , startColumn ) and
152152 locationIncludesPosition ( this .getLocation ( ) , startLine , startColumn )
153153 )
154154 }
@@ -158,8 +158,8 @@ class ErbDirective extends TDirectiveNode, ErbAstNode {
158158 * statement starting in this directive.
159159 */
160160 Stmt getAChildStmt ( ) {
161- this .containsStmtStart ( result ) and
162- not this .containsStmtStart ( parent * ( result ) .getParent ( ) )
161+ this .containsAstNodeStart ( result ) and
162+ not this .containsAstNodeStart ( result .getParent ( ) )
163163 }
164164
165165 /**
@@ -183,11 +183,6 @@ class ErbDirective extends TDirectiveNode, ErbAstNode {
183183 override string getAPrimaryQlClass ( ) { result = "ErbDirective" }
184184}
185185
186- private AstNode parent ( AstNode n ) {
187- result = n .getParent ( ) and
188- not result instanceof Stmt
189- }
190-
191186/**
192187 * A comment directive in an ERB template.
193188 * ```erb
0 commit comments