Skip to content

Commit ea0278e

Browse files
committed
Ruby: Skip BodyStmt in ErbDirective.getAChildStmt.
1 parent e07f45f commit ea0278e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

ruby/ql/lib/codeql/ruby/ast/Erb.qll

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,22 @@ class ErbDirective extends TDirectiveNode, ErbAstNode {
156156
)
157157
}
158158

159+
pragma[nomagic]
160+
private Stmt getAChildStmt0() {
161+
this.containsAstNodeStart(result) and
162+
not this.containsAstNodeStart(result.getParent())
163+
}
164+
159165
/**
160166
* Gets a statement that starts in directive that is not a child of any other
161167
* statement starting in this directive.
162168
*/
163169
cached
164170
Stmt getAChildStmt() {
165-
this.containsAstNodeStart(result) and
166-
not this.containsAstNodeStart(result.getParent())
171+
result = this.getAChildStmt0() and
172+
not result instanceof BodyStmt
173+
or
174+
result = this.getAChildStmt0().(BodyStmt).getAStmt()
167175
}
168176

169177
/**

0 commit comments

Comments
 (0)