Skip to content

Commit 09faa23

Browse files
committed
Ruby printAst: order by line, synth index in synth parent, column, synth index in real parent
This prevents a bunch of unrelated movements in AstDesugar.ql
1 parent 76fa142 commit 09faa23

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
134134
else result = 0
135135
}
136136

137+
private int getSynthAstNodeIndexForSynthParent() {
138+
if this.parentIsSynthesized() then result = this.getSynthAstNodeIndex() else result = 0
139+
}
140+
137141
override int getOrder() {
138142
this =
139143
rank[result](PrintRegularAstNode p, Location l, File f |
@@ -142,8 +146,9 @@ class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
142146
|
143147
p
144148
order by
145-
f.getBaseName(), f.getAbsolutePath(), l.getStartLine(), l.getStartColumn(),
146-
p.getSynthAstNodeIndex(), l.getEndLine(), l.getEndColumn()
149+
f.getBaseName(), f.getAbsolutePath(), l.getStartLine(),
150+
p.getSynthAstNodeIndexForSynthParent(), l.getStartColumn(), p.getSynthAstNodeIndex(),
151+
l.getEndLine(), l.getEndColumn()
147152
)
148153
}
149154

0 commit comments

Comments
 (0)