File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,13 @@ class AmdModuleDefinition extends CallExpr instanceof AmdModuleDefinition::Range
61
61
}
62
62
63
63
/** Gets the `i`th dependency of this module definition. */
64
- PathExpr getDependency ( int i ) { result = this .getDependencies ( ) .getElement ( i ) }
64
+ PathExpr getDependency ( int i ) {
65
+ exists ( Expr expr |
66
+ expr = this .getDependencies ( ) .getElement ( i ) and
67
+ not isPseudoDependency ( expr .getStringValue ( ) ) and
68
+ result = expr
69
+ )
70
+ }
65
71
66
72
/** Gets a dependency of this module definition. */
67
73
PathExpr getADependency ( ) {
@@ -203,11 +209,15 @@ class AmdModuleDefinition extends CallExpr instanceof AmdModuleDefinition::Range
203
209
}
204
210
}
205
211
212
+ private predicate isPseudoDependency ( string s ) { s = [ "exports" , "require" , "module" ] }
213
+
206
214
/** An AMD dependency, considered as a path expression. */
207
215
private class AmdDependencyPath extends PathExprCandidate {
208
216
AmdDependencyPath ( ) {
209
217
exists ( AmdModuleDefinition amd |
210
- this = amd .getDependencies ( ) .getAnElement ( ) or
218
+ this = amd .getDependencies ( ) .getAnElement ( ) and
219
+ not isPseudoDependency ( this .getStringValue ( ) )
220
+ or
211
221
this = amd .getARequireCall ( ) .getAnArgument ( )
212
222
)
213
223
}
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ amdModuleDefinition
61
61
| umd.js:4:9:4:43 | define( ... actory) | umd.js:1:18:1:24 | factory |
62
62
| umd.js:4:9:4:43 | define( ... actory) | umd.js:9:9:14:1 | functio ... };\\n} |
63
63
amdModuleDependencies
64
- | tst2.js:1:1:3:2 | define( ... 42;\\n}) | tst2.js:1:9:1:17 | 'exports' |
65
64
| tst3.js:1:1:3:2 | define( ... 42;\\n}) | tst3.js:2:21:2:25 | './a' |
66
65
| tst4.js:1:1:11:2 | define( ... };\\n}) | tst4.js:2:9:2:14 | 'a.js' |
67
66
| tst4.js:1:1:11:2 | define( ... };\\n}) | tst4.js:3:9:3:13 | 'foo' |
You can’t perform that action at this time.
0 commit comments