@@ -85,6 +85,18 @@ module DataFlow {
85
85
/** Gets the expression corresponding to this data flow node, if any. */
86
86
Expr asExpr ( ) { this = TValueNode ( result ) }
87
87
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
+
88
100
/** Gets the AST node corresponding to this data flow node, if any. */
89
101
ASTNode getAstNode ( ) { none ( ) }
90
102
@@ -983,6 +995,16 @@ module DataFlow {
983
995
* Gets a pseudo-node representing the root of a global access path.
984
996
*/
985
997
DataFlow:: Node globalAccessPathRootPseudoNode ( ) { result instanceof TGlobalAccessPathRoot }
998
+
999
+ /**
1000
+ * Gets a data flow node representing the underlying call performed by the given
1001
+ * call to `Function.prototype.call` or `Function.prototype.apply`.
1002
+ *
1003
+ * For example, for an expression `fn.call(x, y)`, this gets a call node with `fn` as the
1004
+ * callee, `x` as the receiver, and `y` as the first argument.
1005
+ */
1006
+ DataFlow:: InvokeNode reflectiveCallNode ( InvokeExpr expr ) { result = TReflectiveCallNode ( expr , _) }
1007
+
986
1008
987
1009
/**
988
1010
* Gets a data flow node representing the underlying call performed by the given
0 commit comments