@@ -85,6 +85,18 @@ module DataFlow {
8585 /** Gets the expression corresponding to this data flow node, if any. */
8686 Expr asExpr ( ) { this = TValueNode ( result ) }
8787
88+ /**
89+ * Gets the expression enclosing this data flow node.
90+ * In most cases the result is the same as `asExpr()`, however this method
91+ * additionally the `InvokeExpr` corresponding to reflective calls, and the `Parameter`
92+ * for a `DataFlow::ParameterNode`.
93+ */
94+ Expr getEnclosingExpr ( ) {
95+ result = asExpr ( ) or
96+ this = DataFlow:: reflectiveCallNode ( result ) or
97+ result = this .( ParameterNode ) .getParameter ( )
98+ }
99+
88100 /** Gets the AST node corresponding to this data flow node, if any. */
89101 ASTNode getAstNode ( ) { none ( ) }
90102
@@ -950,6 +962,16 @@ module DataFlow {
950962 * Gets a pseudo-node representing the root of a global access path.
951963 */
952964 DataFlow:: Node globalAccessPathRootPseudoNode ( ) { result instanceof TGlobalAccessPathRoot }
965+
966+ /**
967+ * Gets a data flow node representing the underlying call performed by the given
968+ * call to `Function.prototype.call` or `Function.prototype.apply`.
969+ *
970+ * For example, for an expression `fn.call(x, y)`, this gets a call node with `fn` as the
971+ * callee, `x` as the receiver, and `y` as the first argument.
972+ */
973+ DataFlow:: InvokeNode reflectiveCallNode ( InvokeExpr expr ) { result = TReflectiveCallNode ( expr , _) }
974+
953975
954976 /**
955977 * Provides classes representing various kinds of calls.
0 commit comments