JS: add SourceNode support for chained method calls

This commit is contained in:
Esben Sparre Andreasen
2018-10-15 08:42:47 +02:00
parent 1e7696664e
commit 1e115bce2c

View File

@@ -131,6 +131,26 @@ abstract class SourceNode extends DataFlow::Node {
)
}
/**
* Gets a method call that invokes a method on this node.
*
* This includes only calls that have the syntactic shape of a method call,
* that is, `o.m(...)` or `o[p](...)`.
*/
DataFlow::CallNode getAMethodCall() {
result = getAMethodCall(_)
}
/**
* Gets a chained method call that invokes `methodName` last.
*
* The chain steps include only calls that have the syntactic shape of a method call,
* that is, `o.m(...)` or `o[p](...)`.
*/
DataFlow::CallNode getAChainedMethodCall(string methodName) {
result = getAMethodCall*().getAMethodCall(methodName)
}
/**
* Gets a `new` call that invokes constructor `constructorName` on this node.
*/