JavaScript: Turn PathNode::getASuccessorInternal and PathNode::getAHiddenSuccessor into top-level predicates.

This commit is contained in:
Max Schaefer
2019-10-18 17:52:19 +01:00
parent b6f4785645
commit 3373742077

View File

@@ -985,26 +985,10 @@ class PathNode extends TPathNode {
nd = n and cfg = c
}
/**
* Gets a successor node of this path node, including hidden nodes.
*/
private PathNode getASuccessorInternal() {
exists(DataFlow::Node succ, PathSummary newSummary |
flowStep(nd, id(cfg), succ, newSummary) and
result = MkMidNode(succ, id(cfg), summary.append(newSummary))
)
}
/**
* Gets a successor of this path node, if it is a hidden node.
*/
private PathNode getAHiddenSuccessor() {
isHidden() and
result = getASuccessorInternal()
}
/** Gets a successor node of this path node. */
PathNode getASuccessor() { result = getASuccessorInternal().getAHiddenSuccessor*() }
final PathNode getASuccessor() {
result = getASuccessorIfHidden*(getASuccessor(this))
}
/** Gets a textual representation of this path node. */
string toString() { result = nd.toString() }
@@ -1037,6 +1021,21 @@ class PathNode extends TPathNode {
}
}
private PathNode getASuccessor(PathNode pnd) {
exists(DataFlow::Node nd, Configuration cfg, PathSummary summary |
pnd = MkMidNode(nd, cfg, summary) and
exists(DataFlow::Node succ, PathSummary newSummary |
flowStep(nd, id(cfg), succ, newSummary) and
result = MkMidNode(succ, id(cfg), summary.append(newSummary))
)
)
}
private PathNode getASuccessorIfHidden(PathNode nd) {
nd.isHidden() and
result = getASuccessor(nd)
}
/**
* A path node corresponding to a flow source.
*/