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

Skip to content

Commit 2105e0b

Browse files
committed
JS: use JSDoc types in class tracking
1 parent 6b05aa1 commit 2105e0b

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,12 @@ class ClassNode extends DataFlow::SourceNode {
709709
t.start() and
710710
result = getAReceiverNode()
711711
or
712+
t.call() and
713+
exists(Parameter param |
714+
this = param.getTypeAnnotation().getClass() and
715+
result = DataFlow::parameterNode(param)
716+
)
717+
or
712718
result = getAnInstanceReferenceAux(t) and
713719
// Avoid tracking into the receiver of other classes.
714720
// Note that this also blocks flows into a property of the receiver,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ class TypeTracker extends TTypeTracker {
158158
*/
159159
predicate start() { hasCall = false and prop = "" }
160160

161+
/**
162+
* Holds if this is the starting point of type tracking
163+
* when tracking a parameter into a call, but not out of it.
164+
*/
165+
predicate call() { hasCall = true and prop = "" }
166+
161167
/**
162168
* Holds if this is the end point of type tracking.
163169
*/

0 commit comments

Comments
 (0)