Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcb8124

Browse files
committed
JS: Expose data flow node for field declaration
1 parent 9ee893c commit fcb8124

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,22 @@ module DataFlow {
13081308
nd = TFunctionReturnNode(function)
13091309
}
13101310

1311+
/**
1312+
* INTERNAL: Do not use outside standard library.
1313+
*
1314+
* Gets a data flow node unique to the given field declaration.
1315+
*
1316+
* Note that this node defaults to being disconnected from the data flow
1317+
* graph, as the individual property reads and writes affecting the field are
1318+
* analyzed independently of the field declaration.
1319+
*
1320+
* Certain framework models may need this node to model the behavior of
1321+
* class and field decorators.
1322+
*/
1323+
DataFlow::Node fieldDeclarationNode(FieldDeclaration field) {
1324+
result = TPropNode(field)
1325+
}
1326+
13111327
/**
13121328
* Gets the data flow node corresponding the given l-value expression, if
13131329
* such a node exists.

javascript/ql/src/semmle/javascript/frameworks/Angular2.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ module Angular2 {
293293
exists(FieldDeclaration f |
294294
f.getName() = name and
295295
f.getDeclaringClass().flow() = this and
296-
result = f.getNameExpr().flow()
296+
result = DataFlow::fieldDeclarationNode(f)
297297
)
298298
}
299299

0 commit comments

Comments
 (0)