Predicate DataFlow::functionForwardingStep
Holds if the function in succ
forwards all its arguments to a call to pred
and returns
its result. This can thus be seen as a step pred -> succ
used for tracking function values
through “wrapper functions”, since the succ
function partially replicates behavior of pred
.
Examples:
function f(x) {
return g(x); // step: g -> f
}
function doExec(x) {
console.log(x);
return exec(x); // step: exec -> doExec
}
function doEither(x, y) {
if (x > y) {
return foo(x, y); // step: foo -> doEither
} else {
return bar(x, y); // step: bar -> doEither
}
}
function wrapWithLogging(f) {
return (x) => {
console.log(x);
return f(x); // step: f -> anonymous function
}
}
wrapWithLogging(g); // step: g -> wrapWithLogging(g)
Import path
import javascript
predicate functionForwardingStep(Node pred, Node succ)