Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1dde5b8

Browse files
committed
AST synthesis: Move location information into a separate predicate
1 parent dbf1805 commit 1dde5b8

4 files changed

Lines changed: 194 additions & 165 deletions

File tree

ql/src/codeql_ruby/ast/internal/AST.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module MethodName {
1919
}
2020

2121
private predicate mkSynthChild(SynthKind kind, AST::AstNode parent, int i) {
22-
any(Synthesis s).child(parent, i, SynthChild(kind), _)
22+
any(Synthesis s).child(parent, i, SynthChild(kind))
2323
}
2424

2525
cached
@@ -483,7 +483,7 @@ private module Cached {
483483
predicate synthChild(AST::AstNode parent, int i, AST::AstNode child) {
484484
child = getSynthChild(parent, i)
485485
or
486-
any(Synthesis s).child(parent, i, RealChild(child), _)
486+
any(Synthesis s).child(parent, i, RealChild(child))
487487
}
488488

489489
/**
@@ -505,8 +505,11 @@ private module Cached {
505505
Location getLocation(AST::AstNode n) {
506506
synthLocation(n, result)
507507
or
508+
n.isSynthesized() and
508509
not synthLocation(n, _) and
509-
result = toGeneratedInclSynth(n).getLocation()
510+
result = getLocation(n.getParent())
511+
or
512+
result = toGenerated(n).getLocation()
510513
}
511514
}
512515

0 commit comments

Comments
 (0)