Skip to content

Commit 35f7fdf

Browse files
aibaarshvitved
andcommitted
Update ruby/ql/lib/codeql/ruby/printAst.qll
Co-authored-by: Tom Hvitved <hvitved@github.com>
1 parent d8592a2 commit 35f7fdf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ruby/ql/lib/codeql/ruby/printAst.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ private predicate shouldPrintAstEdge(AstNode parent, string edgeName, AstNode ch
3636
any(PrintAstConfiguration config).shouldPrintAstEdge(parent, edgeName, child)
3737
}
3838

39+
private int nonSynthIndex() { result = min([-1, any(int i | exists(getSynthChild(_, i)))]) - 1 }
40+
3941
newtype TPrintNode =
4042
TPrintRegularAstNode(AstNode n) { shouldPrintNode(n) } or
4143
TPrintRegExpNode(RE::RegExpTerm term) {
@@ -114,7 +116,7 @@ class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
114116
}
115117

116118
private int getSynthAstNodeIndex() {
117-
not astNode.isSynthesized() and result = -10
119+
not astNode.isSynthesized() and result = nonSynthIndex()
118120
or
119121
astNode = getSynthChild(astNode.getParent(), result)
120122
}

0 commit comments

Comments
 (0)