Skip to content

Commit a73cdf3

Browse files
authored
Merge pull request #7911 from kaeluka/javascript/add-getFlowLabel-to-PathNode
JS: add a getFlowLabel method to the PathNode class
2 parents f302222 + 3e88d46 commit a73cdf3

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,22 @@ class PathNode extends TPathNode {
18001800
) {
18011801
nd.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
18021802
}
1803+
1804+
/**
1805+
* Gets a summary for the path node.
1806+
*/
1807+
PathSummary getPathSummary() {
1808+
this = MkMidNode(_, _, result)
1809+
or
1810+
this = MkSinkNode(_, _) and getASuccessor(MkMidNode(_, _, result)) = this
1811+
or
1812+
this = MkSourceNode(_, _) and getASuccessor(this) = MkMidNode(_, _, result)
1813+
}
1814+
1815+
/**
1816+
* Gets a flow label for the path node.
1817+
*/
1818+
FlowLabel getFlowLabel() { result = getPathSummary().getEndLabel() }
18031819
}
18041820

18051821
/** Gets the mid node corresponding to `src`. */
@@ -1872,9 +1888,6 @@ class MidPathNode extends PathNode, MkMidNode {
18721888

18731889
MidPathNode() { this = MkMidNode(nd, cfg, summary) }
18741890

1875-
/** Gets the summary of the path underlying this path node. */
1876-
PathSummary getPathSummary() { result = summary }
1877-
18781891
/** Holds if this path node wraps data-flow node `nd`, configuration `c` and summary `s`. */
18791892
predicate wraps(DataFlow::Node n, DataFlow::Configuration c, PathSummary s) {
18801893
nd = n and cfg = c and summary = s

0 commit comments

Comments
 (0)