JS: Expose data flow node for field declaration

This commit is contained in:
Asger Feldthaus
2020-12-12 20:50:55 +00:00
parent 9ee893c9c1
commit fcb8124376
2 changed files with 17 additions and 1 deletions

View File

@@ -1308,6 +1308,22 @@ module DataFlow {
nd = TFunctionReturnNode(function)
}
/**
* INTERNAL: Do not use outside standard library.
*
* Gets a data flow node unique to the given field declaration.
*
* Note that this node defaults to being disconnected from the data flow
* graph, as the individual property reads and writes affecting the field are
* analyzed independently of the field declaration.
*
* Certain framework models may need this node to model the behavior of
* class and field decorators.
*/
DataFlow::Node fieldDeclarationNode(FieldDeclaration field) {
result = TPropNode(field)
}
/**
* Gets the data flow node corresponding the given l-value expression, if
* such a node exists.

View File

@@ -293,7 +293,7 @@ module Angular2 {
exists(FieldDeclaration f |
f.getName() = name and
f.getDeclaringClass().flow() = this and
result = f.getNameExpr().flow()
result = DataFlow::fieldDeclarationNode(f)
)
}