Skip to content

Commit 4391b70

Browse files
committed
JS: Fix perf issue in mayReceiveArgument
1 parent e3fed39 commit 4391b70

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

javascript/ql/src/semmle/javascript/dataflow/internal/VariableTypeInference.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,14 +697,14 @@ abstract private class CallWithAnalyzedParameters extends FunctionWithAnalyzedPa
697697
}
698698

699699
override predicate mayReceiveArgument(Parameter p) {
700-
exists(DataFlow::InvokeNode invk, int argIdx |
701-
invk = getAnInvocation() and
702-
p = getParameter(argIdx)
703-
|
704-
exists(invk.getArgument(argIdx))
705-
or
706-
invk.asExpr().(InvokeExpr).isSpreadArgument([0 .. argIdx])
700+
exists(int argIdx |
701+
p = getParameter(argIdx) and
702+
getAnInvocation().getNumArgument() > argIdx
707703
)
704+
or
705+
// All parameters may receive an argument if invoked with a spread argument
706+
p = getAParameter() and
707+
getAnInvocation().asExpr().(InvokeExpr).isSpreadArgument(_)
708708
}
709709
}
710710

0 commit comments

Comments
 (0)