@@ -61,8 +61,14 @@ class AmdModuleDefinition extends CallExpr instanceof AmdModuleDefinition::Range
6161 result = this .getArgument ( 1 )
6262 }
6363
64+ /** DEPRECATED. Use `getDependencyExpr` instead. */
65+ deprecated PathExpr getDependency ( int i ) { result = this .getDependencyExpr ( i ) }
66+
67+ /** DEPRECATED. Use `getADependencyExpr` instead. */
68+ deprecated PathExpr getADependency ( ) { result = this .getADependencyExpr ( ) }
69+
6470 /** Gets the `i`th dependency of this module definition. */
65- PathExpr getDependency ( int i ) {
71+ Expr getDependencyExpr ( int i ) {
6672 exists ( Expr expr |
6773 expr = this .getDependencies ( ) .getElement ( i ) and
6874 not isPseudoDependency ( expr .getStringValue ( ) ) and
@@ -71,8 +77,8 @@ class AmdModuleDefinition extends CallExpr instanceof AmdModuleDefinition::Range
7177 }
7278
7379 /** Gets a dependency of this module definition. */
74- PathExpr getADependency ( ) {
75- result = this .getDependency ( _) or
80+ Expr getADependencyExpr ( ) {
81+ result = this .getDependencyExpr ( _) or
7682 result = this .getARequireCall ( ) .getAnArgument ( )
7783 }
7884
@@ -233,7 +239,7 @@ private class AmdDependencyPath extends PathExprCandidate {
233239}
234240
235241/** A constant path element appearing in an AMD dependency expression. */
236- private class ConstantAmdDependencyPathElement extends PathExpr , ConstantString {
242+ deprecated private class ConstantAmdDependencyPathElement extends PathExpr , ConstantString {
237243 ConstantAmdDependencyPathElement ( ) { this = any ( AmdDependencyPath amd ) .getAPart ( ) }
238244
239245 override string getValue ( ) { result = this .getStringValue ( ) }
@@ -261,11 +267,13 @@ private predicate amdModuleTopLevel(AmdModuleDefinition def, TopLevel tl) {
261267 * An AMD dependency, viewed as an import.
262268 */
263269private class AmdDependencyImport extends Import {
264- AmdDependencyImport ( ) { this = any ( AmdModuleDefinition def ) .getADependency ( ) }
270+ AmdDependencyImport ( ) { this = any ( AmdModuleDefinition def ) .getADependencyExpr ( ) }
265271
266- override Module getEnclosingModule ( ) { this = result .( AmdModule ) .getDefine ( ) .getADependency ( ) }
272+ override Module getEnclosingModule ( ) {
273+ this = result .( AmdModule ) .getDefine ( ) .getADependencyExpr ( )
274+ }
267275
268- override PathExpr getImportedPath ( ) { result = this }
276+ override Expr getImportedPathExpr ( ) { result = this }
269277
270278 /**
271279 * Gets a file that looks like it might be the target of this import.
@@ -274,7 +282,7 @@ private class AmdDependencyImport extends Import {
274282 * adding well-known JavaScript file extensions like `.js`.
275283 */
276284 private File guessTarget ( ) {
277- exists ( PathString imported , string abspath , string dirname , string basename |
285+ exists ( FilePath imported , string abspath , string dirname , string basename |
278286 this .targetCandidate ( result , abspath , imported , dirname , basename )
279287 |
280288 abspath .regexpMatch ( ".*/\\Q" + imported + "\\E" )
@@ -296,9 +304,9 @@ private class AmdDependencyImport extends Import {
296304 * `dirname` and `basename` to the dirname and basename (respectively) of `imported`.
297305 */
298306 private predicate targetCandidate (
299- File f , string abspath , PathString imported , string dirname , string basename
307+ File f , string abspath , FilePath imported , string dirname , string basename
300308 ) {
301- imported = this .getImportedPath ( ) . getValue ( ) and
309+ imported = this .getImportedPathString ( ) and
302310 f .getStem ( ) = imported .getStem ( ) and
303311 f .getAbsolutePath ( ) = abspath and
304312 dirname = imported .getDirName ( ) and
0 commit comments