JS: use JSDoc types in class tracking

This commit is contained in:
Asger F
2019-07-26 09:05:36 +01:00
parent 6b05aa129c
commit 2105e0bdee
2 changed files with 12 additions and 0 deletions

View File

@@ -709,6 +709,12 @@ class ClassNode extends DataFlow::SourceNode {
t.start() and
result = getAReceiverNode()
or
t.call() and
exists(Parameter param |
this = param.getTypeAnnotation().getClass() and
result = DataFlow::parameterNode(param)
)
or
result = getAnInstanceReferenceAux(t) and
// Avoid tracking into the receiver of other classes.
// Note that this also blocks flows into a property of the receiver,

View File

@@ -158,6 +158,12 @@ class TypeTracker extends TTypeTracker {
*/
predicate start() { hasCall = false and prop = "" }
/**
* Holds if this is the starting point of type tracking
* when tracking a parameter into a call, but not out of it.
*/
predicate call() { hasCall = true and prop = "" }
/**
* Holds if this is the end point of type tracking.
*/