Skip to content

Commit 32d002e

Browse files
authored
Merge pull request #10627 from hvitved/ruby/synthesis-reduce-non-linear-rec
Ruby: Reduce size of input predicate for non-linear recursion
2 parents 5017b21 + a5fbe75 commit 32d002e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ruby/ql/lib/codeql/ruby/ast/internal/Synthesis.qll

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,11 @@ private module SetterDesugar {
255255
MethodCall getMethodCall() { result = mc }
256256

257257
pragma[nomagic]
258-
MethodCallKind getCallKind(boolean setter, int arity) {
259-
result = MethodCallKind(mc.getMethodName(), setter, arity)
258+
private string getMethodName() { result = mc.getMethodName() }
259+
260+
pragma[nomagic]
261+
MethodCallKind getCallKind(int arity) {
262+
result = MethodCallKind(this.getMethodName(), true, arity)
260263
}
261264

262265
pragma[nomagic]
@@ -282,7 +285,7 @@ private module SetterDesugar {
282285
exists(AstNode seq | seq = TStmtSequenceSynth(sae, -1) |
283286
parent = seq and
284287
i = 0 and
285-
child = SynthChild(sae.getCallKind(true, sae.getNumberOfArguments() + 1))
288+
child = SynthChild(sae.getCallKind(sae.getNumberOfArguments() + 1))
286289
or
287290
exists(AstNode call | call = TMethodCallSynth(seq, 0, _, _, _) |
288291
parent = call and
@@ -492,9 +495,12 @@ private module AssignOperationDesugar {
492495

493496
MethodCall getMethodCall() { result = mc }
494497

498+
pragma[nomagic]
499+
private string getMethodName() { result = mc.getMethodName() }
500+
495501
pragma[nomagic]
496502
MethodCallKind getCallKind(boolean setter, int arity) {
497-
result = MethodCallKind(mc.getMethodName(), setter, arity)
503+
result = MethodCallKind(this.getMethodName(), setter, arity)
498504
}
499505

500506
pragma[nomagic]

0 commit comments

Comments
 (0)