Skip to content

Commit

Permalink
Update ruby/ql/lib/codeql/ruby/printAst.qll
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Hvitved <hvitved@github.com>
  • Loading branch information
aibaars and hvitved committed Aug 3, 2022
1 parent d8592a2 commit 35f7fdf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ruby/ql/lib/codeql/ruby/printAst.qll
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ private predicate shouldPrintAstEdge(AstNode parent, string edgeName, AstNode ch
any(PrintAstConfiguration config).shouldPrintAstEdge(parent, edgeName, child)
}

private int nonSynthIndex() { result = min([-1, any(int i | exists(getSynthChild(_, i)))]) - 1 }

newtype TPrintNode =
TPrintRegularAstNode(AstNode n) { shouldPrintNode(n) } or
TPrintRegExpNode(RE::RegExpTerm term) {
Expand Down Expand Up @@ -114,7 +116,7 @@ class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
}

private int getSynthAstNodeIndex() {
not astNode.isSynthesized() and result = -10
not astNode.isSynthesized() and result = nonSynthIndex()
or
astNode = getSynthChild(astNode.getParent(), result)
}
Expand Down

0 comments on commit 35f7fdf

Please sign in to comment.