Skip to content

Commit 2c7ec9c

Browse files
author
Max Schaefer
committed
Manually write out a transitive closure.
1 parent 2acd912 commit 2c7ec9c

File tree

1 file changed

+10
-1
lines changed
  • javascript/ql/lib/semmle/javascript

1 file changed

+10
-1
lines changed

javascript/ql/lib/semmle/javascript/AMD.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,22 @@ private class ConstantAmdDependencyPathElement extends PathExpr, ConstantString
203203
override string getValue() { result = getStringValue() }
204204
}
205205

206+
/**
207+
* Holds if `nd` is nested inside an AMD module definition.
208+
*/
209+
private predicate inAmdModuleDefinition(AstNode nd) {
210+
nd.getParent() instanceof AmdModuleDefinition
211+
or
212+
inAmdModuleDefinition(nd.getParent())
213+
}
214+
206215
/**
207216
* Holds if `def` is an AMD module definition in `tl` which is not
208217
* nested inside another module definition.
209218
*/
210219
private predicate amdModuleTopLevel(AmdModuleDefinition def, TopLevel tl) {
211220
def.getTopLevel() = tl and
212-
not def.getParent+() instanceof AmdModuleDefinition
221+
not inAmdModuleDefinition(def)
213222
}
214223

215224
/**

0 commit comments

Comments
 (0)