Skip to content

Commit ef72e22

Browse files
authored
Merge pull request github#11513 from asgerf/js/api-graph-async-result-node
JS: Remove MkAsyncFunctionResult
2 parents 7bf0e7c + eb9bee2 commit ef72e22

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

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

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ module API {
460460
this = Impl::MkClassInstance(result) or
461461
this = Impl::MkUse(result) or
462462
this = Impl::MkDef(result) or
463-
this = Impl::MkAsyncFuncResult(result) or
464463
this = Impl::MkSyntheticCallbackArg(_, _, result)
465464
}
466465

@@ -671,9 +670,6 @@ module API {
671670
cls.getAnInstanceReference() = trackDefNode(_)
672671
)
673672
} or
674-
MkAsyncFuncResult(DataFlow::FunctionNode f) {
675-
f = trackDefNode(_) and f.getFunction().isAsync() and hasSemantics(f)
676-
} or
677673
MkDef(DataFlow::Node nd) { rhs(_, _, nd) } or
678674
MkUse(DataFlow::Node nd) { use(_, _, nd) } or
679675
/** A use of a TypeScript type. */
@@ -688,8 +684,7 @@ module API {
688684

689685
class TDef = MkModuleDef or TNonModuleDef;
690686

691-
class TNonModuleDef =
692-
MkModuleExport or MkClassInstance or MkAsyncFuncResult or MkDef or MkSyntheticCallbackArg;
687+
class TNonModuleDef = MkModuleExport or MkClassInstance or MkDef or MkSyntheticCallbackArg;
693688

694689
class TUse = MkModuleUse or MkModuleImport or MkUse or MkTypeUse;
695690

@@ -740,10 +735,11 @@ module API {
740735
rhs = m.getAnExportedValue(prop)
741736
)
742737
or
743-
exists(DataFlow::FunctionNode fn | fn = pred |
744-
not fn.getFunction().isAsync() and
745-
lbl = Label::return() and
746-
rhs = fn.getAReturn()
738+
exists(DataFlow::FunctionNode fn |
739+
fn = pred and
740+
lbl = Label::return()
741+
|
742+
if fn.getFunction().isAsync() then rhs = fn.getReturnNode() else rhs = fn.getAReturn()
747743
)
748744
or
749745
lbl = Label::promised() and
@@ -774,13 +770,12 @@ module API {
774770
)
775771
or
776772
exists(DataFlow::FunctionNode f |
777-
base = MkAsyncFuncResult(f) and
773+
f.getFunction().isAsync() and
774+
base = MkDef(f.getReturnNode())
775+
|
778776
lbl = Label::promised() and
779777
rhs = f.getAReturn()
780-
)
781-
or
782-
exists(DataFlow::FunctionNode f |
783-
base = MkAsyncFuncResult(f) and
778+
or
784779
lbl = Label::promisedError() and
785780
rhs = f.getExceptionalReturn()
786781
)
@@ -1272,10 +1267,11 @@ module API {
12721267
)
12731268
or
12741269
exists(DataFlow::Node nd, DataFlow::FunctionNode f |
1270+
f.getFunction().isAsync() and
12751271
pred = MkDef(nd) and
12761272
f = trackDefNode(nd) and
12771273
lbl = Label::return() and
1278-
succ = MkAsyncFuncResult(f)
1274+
succ = MkDef(f.getReturnNode())
12791275
)
12801276
or
12811277
exists(int bound, DataFlow::InvokeNode call |

0 commit comments

Comments
 (0)