Skip to content

Commit 63b97cb

Browse files
author
Max Schaefer
committed
Manually write out a transitive closure.
1 parent 67236e0 commit 63b97cb

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
@@ -208,13 +208,22 @@ private class ConstantAmdDependencyPathElement extends PathExpr, ConstantString
208208
override string getValue() { result = getStringValue() }
209209
}
210210

211+
/**
212+
* Holds if `nd` is nested inside an AMD module definition.
213+
*/
214+
private predicate inAmdModuleDefinition(ASTNode nd) {
215+
nd.getParent() instanceof AmdModuleDefinition
216+
or
217+
inAmdModuleDefinition(nd.getParent())
218+
}
219+
211220
/**
212221
* Holds if `def` is an AMD module definition in `tl` which is not
213222
* nested inside another module definition.
214223
*/
215224
private predicate amdModuleTopLevel(AmdModuleDefinition def, TopLevel tl) {
216225
def.getTopLevel() = tl and
217-
not def.getParent+() instanceof AmdModuleDefinition
226+
not inAmdModuleDefinition(def)
218227
}
219228

220229
/**

0 commit comments

Comments
 (0)