Skip to content

Commit 4793431

Browse files
committed
JS: Hide captured nodes in path explanations
1 parent 1f496d3 commit 4793431

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,9 @@ class MidPathNode extends PathNode, MkMidNode {
14621462
or
14631463
// Skip the synthetic 'this' node, as a ThisExpr will be the next node anyway
14641464
nd = DataFlow::thisNode(_)
1465+
or
1466+
// Skip captured variable nodes as the successor will be a use of that variable anyway.
1467+
nd = DataFlow::capturedVariableNode(_)
14651468
}
14661469
}
14671470

javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,15 @@ module DataFlow {
12451245
}
12461246
}
12471247

1248+
/**
1249+
* INTERNAL. DO NOT USE.
1250+
*
1251+
* Gets a data flow node representing the given captured variable.
1252+
*/
1253+
Node capturedVariableNode(LocalVariable variable) {
1254+
result = TCapturedVariableNode(variable)
1255+
}
1256+
12481257
/**
12491258
* Gets the data flow node corresponding to `nd`.
12501259
*

0 commit comments

Comments
 (0)