Skip to content

Commit 40ec23c

Browse files
committed
refactor MkHasUnderlyingType to use Label::instance()
1 parent d1602d5 commit 40ec23c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

javascript/ql/src/semmle/javascript/ApiGraphs.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ module API {
318318
result = Impl::MkCanonicalNameUse(tn).(Node).getInstance()
319319
)
320320
or
321-
result = Impl::MkHasUnderlyingType(moduleName, exportedName)
321+
result = Impl::MkHasUnderlyingType(moduleName, exportedName).(Node).getInstance()
322322
}
323323
}
324324

@@ -416,7 +416,7 @@ module API {
416416
isUsed(n)
417417
} or
418418
/**
419-
* An instance of a TypeScript type, identified by name of the type-annotation.
419+
* A TypeScript type, identified by name of the type-annotation.
420420
* This API node is exclusively used by `API::Node::ofType`.
421421
*/
422422
MkHasUnderlyingType(string moduleName, string exportName) {
@@ -649,6 +649,12 @@ module API {
649649
ref = getANodeWithType(tn)
650650
)
651651
or
652+
exists(string moduleName, string exportName |
653+
base = MkHasUnderlyingType(moduleName, exportName) and
654+
lbl = Label::instance() and
655+
ref.(DataFlow::SourceNode).hasUnderlyingType(moduleName, exportName)
656+
)
657+
or
652658
exists(DataFlow::InvokeNode call |
653659
base = MkSyntheticCallbackArg(_, _, call) and
654660
lbl = Label::parameter(1) and
@@ -688,12 +694,6 @@ module API {
688694
nd = MkUse(ref)
689695
or
690696
exists(CanonicalName n | nd = MkCanonicalNameUse(n) | ref.asExpr() = n.getAnAccess())
691-
or
692-
exists(string moduleName, string exportsName |
693-
nd = MkHasUnderlyingType(moduleName, exportsName)
694-
|
695-
ref.(DataFlow::SourceNode).hasUnderlyingType(moduleName, exportsName)
696-
)
697697
}
698698

699699
/** Holds if module `m` exports `rhs`. */

0 commit comments

Comments
 (0)