Skip to content

Commit e0fb2d0

Browse files
committed
JS: Use forceLocal to implement MkTypeUse
1 parent c8e83df commit e0fb2d0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,14 @@ module API {
735735
*/
736736
cached
737737
private module Impl {
738+
private predicate hasTypeUse(string moduleName, string exportName) {
739+
any(TypeAnnotation n).hasUnderlyingType(moduleName, exportName)
740+
}
741+
742+
overlay[local]
743+
private predicate hasTypeUseLocal(string moduleName, string exportName) =
744+
forceLocal(hasTypeUse/2)(moduleName, exportName)
745+
738746
overlay[local]
739747
cached
740748
newtype TApiNode =
@@ -771,10 +779,7 @@ module API {
771779
} or
772780
MkUse(DataFlow::Node nd) { nd instanceof DataFlow::SourceNode } or
773781
/** A use of a TypeScript type. */
774-
MkTypeUse(string moduleName, string exportName) {
775-
// any(TypeAnnotation n).hasUnderlyingType(moduleName, exportName)
776-
none() // TODO
777-
} or
782+
MkTypeUse(string moduleName, string exportName) { hasTypeUseLocal(moduleName, exportName) } or
778783
MkSyntheticCallbackArg(DataFlow::InvokeNode nd)
779784

780785
class TDef = MkModuleDef or TNonModuleDef;

0 commit comments

Comments
 (0)