Skip to content

Commit 7b7e87f

Browse files
committed
JS: Fix bad join order in closure
1 parent aa1c8c0 commit 7b7e87f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

javascript/ql/src/semmle/javascript/Closure.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ module Closure {
129129
container = result.getContainer()
130130
}
131131

132+
pragma[noinline]
133+
private ClosureRequireCall getARequireInTopLevel(ClosureModule m) {
134+
result.getTopLevel() = m
135+
}
136+
132137
/**
133138
* A module using the Closure module system, declared using `goog.module()` or `goog.declareModuleId()`.
134139
*/
@@ -146,10 +151,7 @@ module Closure {
146151
string getClosureNamespace() { result = getModuleDeclaration().getClosureNamespace() }
147152

148153
override Module getAnImportedModule() {
149-
exists(ClosureRequireCall imprt |
150-
imprt.getTopLevel() = this and
151-
result.(ClosureModule).getClosureNamespace() = imprt.getClosureNamespace()
152-
)
154+
result.(ClosureModule).getClosureNamespace() = getARequireInTopLevel(this).getClosureNamespace()
153155
}
154156

155157
/**

0 commit comments

Comments
 (0)