Skip to content

Commit b834ffe

Browse files
committed
JS: Fix a bad join order
1 parent 1ad471c commit b834ffe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,12 +955,17 @@ module API {
955955
result = min(int i | expr.getArgument(i) instanceof SpreadElement)
956956
}
957957

958+
pragma[nomagic]
959+
private InvokeExpr getAnInvocationWithSpread(DataFlow::SourceNode node, int i) {
960+
result = node.getAnInvocation().asExpr() and
961+
i = firstSpreadIndex(result)
962+
}
963+
958964
private predicate spreadArgumentPassing(TApiNode base, int i, DataFlow::Node spreadArray) {
959965
exists(DataFlow::Node use, DataFlow::SourceNode pred, int bound, InvokeExpr invoke |
960966
use(base, use) and
961967
pred = trackUseNode(use, _, bound, "") and
962-
invoke = pred.getAnInvocation().asExpr() and
963-
i = firstSpreadIndex(invoke) and
968+
invoke = getAnInvocationWithSpread(pred, i) and
964969
spreadArray = invoke.getArgument(i - bound).(SpreadElement).getOperand().flow()
965970
)
966971
}

0 commit comments

Comments
 (0)