Skip to content

Commit 7fc8753

Browse files
committed
JS: Make MkSyntheticCallbackArg() independent of trackUseNode
1 parent 12c0ad0 commit 7fc8753

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ module API {
545545
this = Impl::MkClassInstance(result) or
546546
this = Impl::MkUse(result) or
547547
this = Impl::MkDef(result) or
548-
this = Impl::MkSyntheticCallbackArg(_, _, result)
548+
this = Impl::MkSyntheticCallbackArg(result)
549549
}
550550

551551
/**
@@ -760,9 +760,7 @@ module API {
760760
MkTypeUse(string moduleName, string exportName) {
761761
any(TypeAnnotation n).hasUnderlyingType(moduleName, exportName)
762762
} or
763-
MkSyntheticCallbackArg(DataFlow::Node src, int bound, DataFlow::InvokeNode nd) {
764-
trackUseNode(src, true, bound, "").flowsTo(nd.getCalleeNode())
765-
}
763+
MkSyntheticCallbackArg(DataFlow::InvokeNode nd)
766764

767765
private predicate needsDefNode(DataFlow::ClassNode cls) {
768766
hasSemantics(cls) and
@@ -1110,7 +1108,7 @@ module API {
11101108
)
11111109
or
11121110
exists(DataFlow::InvokeNode call |
1113-
base = MkSyntheticCallbackArg(_, _, call) and
1111+
base = MkSyntheticCallbackArg(call) and
11141112
lbl = Label::parameter(1) and
11151113
ref = awaited(call)
11161114
)
@@ -1399,7 +1397,7 @@ module API {
13991397

14001398
private DataFlow::SourceNode awaited(DataFlow::InvokeNode call, DataFlow::TypeTracker t) {
14011399
t.startInPromise() and
1402-
exists(MkSyntheticCallbackArg(_, _, call)) and
1400+
trackUseNode(_, true, _, "").flowsTo(call.getCalleeNode()) and
14031401
result = call
14041402
or
14051403
exists(DataFlow::TypeTracker t2 | result = awaited(call, t2).track(t2, t))
@@ -1494,7 +1492,8 @@ module API {
14941492
DataFlow::InvokeNode getAPromisifiedInvocation(TApiNode callee, int bound, TApiNode succ) {
14951493
exists(DataFlow::SourceNode src |
14961494
Impl::use(callee, src) and
1497-
succ = Impl::MkSyntheticCallbackArg(src, bound, result)
1495+
trackUseNode(src, true, bound, "").flowsTo(result.getCalleeNode()) and
1496+
succ = Impl::MkSyntheticCallbackArg(result)
14981497
)
14991498
}
15001499
}

0 commit comments

Comments
 (0)