JS:Add ConstructorThisArgumentNode

This commit is contained in:
Asger F
2023-10-03 09:51:13 +02:00
parent b499c6075a
commit 21300eef4c
2 changed files with 19 additions and 0 deletions

View File

@@ -1055,6 +1055,24 @@ module DataFlow {
override string toString() { result = "global access path" }
}
/**
* A node representing the value passed as `this` argument in a `new` call or a `super` call.
*/
class ConstructorThisArgumentNode extends TConstructorThisArgumentNode, DataFlow::Node {
private InvokeExpr expr;
ConstructorThisArgumentNode() { this = TConstructorThisArgumentNode(expr) }
override string toString() { result = "implicit 'this' argument of " + expr }
override StmtContainer getContainer() { result = expr.getContainer() }
override predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
expr.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
}
/**
* INTERNAL. DO NOT USE.
*

View File

@@ -34,6 +34,7 @@ private module Cached {
TGlobalAccessPathRoot() or
TTemplatePlaceholderTag(Templating::TemplatePlaceholderTag tag) or
TReflectiveParametersNode(Function f) or
TConstructorThisArgumentNode(InvokeExpr e) { e instanceof NewExpr or e instanceof SuperCall } or
}
import Cached