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

Skip to content

Commit f84a055

Browse files
committed
JS: ArraySliceStep
1 parent 6331529 commit f84a055

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

javascript/ql/src/semmle/javascript/Arrays.qll

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,17 +279,14 @@ private module ArrayDataFlow {
279279
/**
280280
* A step for modelling that elements from an array `arr` also appear in the result from calling `slice`/`splice`/`filter`.
281281
*/
282-
private class ArraySliceStep extends DataFlow::AdditionalFlowStep, DataFlow::MethodCallNode {
283-
ArraySliceStep() {
284-
this.getMethodName() = "slice" or
285-
this.getMethodName() = "splice" or
286-
this.getMethodName() = "filter"
287-
}
288-
282+
private class ArraySliceStep extends DataFlow::SharedFlowStep {
289283
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
290-
prop = arrayElement() and
291-
pred = this.getReceiver() and
292-
succ = this
284+
exists(DataFlow::MethodCallNode call |
285+
call.getMethodName() = ["slice", "splice", "filter"] and
286+
prop = arrayElement() and
287+
pred = call.getReceiver() and
288+
succ = call
289+
)
293290
}
294291
}
295292

0 commit comments

Comments
 (0)