Skip to content

Commit b95092e

Browse files
committed
Ruby printAst: order by start line and column before synth index
This counteracts the movement of synth children away from the node from which they take their location, following the decision to take the index of synth children of real parents into account.
1 parent 2511f52 commit b95092e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ class PrintRegularAstNode extends PrintAstNode, TPrintRegularAstNode {
142142
|
143143
p
144144
order by
145-
f.getBaseName(), f.getAbsolutePath(), l.getStartLine(), p.getSynthAstNodeIndex(),
146-
l.getStartColumn(), l.getEndLine(), l.getEndColumn()
145+
f.getBaseName(), f.getAbsolutePath(), l.getStartLine(), l.getStartColumn(),
146+
p.getSynthAstNodeIndex(), l.getEndLine(), l.getEndColumn()
147147
)
148148
}
149149

ruby/ql/test/library-tests/ast/Ast.expected

+3-3
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,8 @@ control/cases.rb:
915915
# 56| getValue: [IntegerLiteral] 5
916916
# 56| getKey: [SymbolLiteral] :b
917917
# 56| getComponent: [StringTextComponent] b
918-
# 56| getRestVariableAccess: [LocalVariableAccess] map
919918
# 56| getValue: [LocalVariableAccess] b
919+
# 56| getRestVariableAccess: [LocalVariableAccess] map
920920
# 57| getBranch: [InClause] in ... then ...
921921
# 57| getPattern: [HashPattern] { ..., ** }
922922
# 57| getKey: [SymbolLiteral] :a
@@ -1006,8 +1006,8 @@ control/cases.rb:
10061006
# 75| getValue: [IntegerLiteral] 5
10071007
# 75| getKey: [SymbolLiteral] :b
10081008
# 75| getComponent: [StringTextComponent] b
1009-
# 75| getRestVariableAccess: [LocalVariableAccess] map
10101009
# 75| getValue: [LocalVariableAccess] b
1010+
# 75| getRestVariableAccess: [LocalVariableAccess] map
10111011
# 76| getBranch: [InClause] in ... then ...
10121012
# 76| getPattern: [HashPattern] { ..., ** }
10131013
# 76| getKey: [SymbolLiteral] :a
@@ -1209,8 +1209,8 @@ control/cases.rb:
12091209
# 141| getValue: [IntegerLiteral] 1
12101210
# 141| getKey: [SymbolLiteral] :a
12111211
# 141| getComponent: [StringTextComponent] a
1212-
# 141| getRestVariableAccess: [LocalVariableAccess] rest
12131212
# 141| getValue: [LocalVariableAccess] a
1213+
# 141| getRestVariableAccess: [LocalVariableAccess] rest
12141214
# 142| getBranch: [InClause] in ... then ...
12151215
# 142| getPattern: [HashPattern] { ..., ** }
12161216
# 142| getClass: [ConstantReadAccess] Foo

0 commit comments

Comments
 (0)