mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Ruby printAst: fix order for synth children of real parents
Real parents can have synthesized children, so always assigning index 0 leads to nondeterminism in graph output.
This commit is contained in:
@@ -121,15 +121,17 @@ class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
|
||||
}
|
||||
|
||||
private int getSynthAstNodeIndex() {
|
||||
this.parentIsSynthesized() and
|
||||
exists(AstNode parent |
|
||||
shouldPrintAstEdge(parent, _, astNode) and
|
||||
parent.isSynthesized() and
|
||||
synthChild(parent, result, astNode)
|
||||
)
|
||||
or
|
||||
not this.parentIsSynthesized() and
|
||||
result = 0
|
||||
if
|
||||
exists(AstNode parent |
|
||||
shouldPrintAstEdge(parent, _, astNode) and
|
||||
synthChild(parent, _, astNode)
|
||||
)
|
||||
then
|
||||
exists(AstNode parent |
|
||||
shouldPrintAstEdge(parent, _, astNode) and
|
||||
synthChild(parent, result, astNode)
|
||||
)
|
||||
else result = 0
|
||||
}
|
||||
|
||||
override int getOrder() {
|
||||
|
||||
Reference in New Issue
Block a user