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

Skip to content

Commit 4a45731

Browse files
committed
JS: SetMapForEach
1 parent c9c9946 commit 4a45731

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

javascript/ql/src/semmle/javascript/Collections.qll

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,14 @@ private module CollectionDataFlow {
181181
/**
182182
* A step for a call to `forEach` on a Set or Map.
183183
*/
184-
private class SetMapForEach extends CollectionFlowStep, DataFlow::MethodCallNode {
185-
SetMapForEach() { this.getMethodName() = "forEach" }
186-
187-
override predicate load(DataFlow::Node obj, DataFlow::Node element, PseudoProperty prop) {
188-
obj = this.getReceiver() and
189-
element = this.getCallback(0).getParameter(0) and
190-
prop = [setElement(), mapValueAll()]
184+
private class SetMapForEach extends PreCallGraphStep {
185+
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
186+
exists(DataFlow::MethodCallNode call |
187+
call.getMethodName() = "forEach" and
188+
obj = call.getReceiver() and
189+
element = call.getCallback(0).getParameter(0) and
190+
prop = [setElement(), mapValueAll()]
191+
)
191192
}
192193
}
193194

0 commit comments

Comments
 (0)