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

Co-authored-by: Tom Hvitved <hvitved@github.com>
This commit is contained in:
Arthur Baars
2022-08-03 10:18:37 +02:00
parent d8592a2b05
commit 35f7fdf24b

View File

@@ -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) {
@@ -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)
}