Skip to content

Commit 844e012

Browse files
committed
Ruby: Perf fix for trackUseNode.
1 parent 4f93f2b commit 844e012

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ruby/ql/lib/codeql/ruby/ApiGraphs.qll

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,18 @@ module API {
606606
result = useCandRev() and
607607
t.start()
608608
or
609-
exists(TypeTracker t2, DataFlow::LocalSourceNode mid, TypeBackTracker tb |
609+
exists(TypeTracker t2, DataFlow::LocalSourceNode mid |
610610
mid = trackUseNode(src, t2) and
611-
result = mid.track(t2, t) and
612-
pragma[only_bind_out](result) = useCandRev(tb) and
613-
pragma[only_bind_out](t) = pragma[only_bind_out](tb).getACompatibleTypeTracker()
611+
result = useNodeStep(mid, t2, t)
612+
)
613+
}
614+
615+
pragma[nomagic]
616+
private DataFlow::Node useNodeStep(DataFlow::LocalSourceNode mid, TypeTracker tmid, TypeTracker t) {
617+
exists(TypeBackTracker tb |
618+
result = mid.track(tmid, t) and
619+
pragma[only_bind_into](result) = useCandRev(pragma[only_bind_into](tb)) and
620+
pragma[only_bind_out](t) = tb.getACompatibleTypeTracker()
614621
)
615622
}
616623

0 commit comments

Comments
 (0)