@@ -115,7 +115,7 @@ abstract class Module extends TopLevel {
115115 }
116116}
117117
118- private predicate shouldResolveExpr ( Expr e ) { e = any ( Import imprt ) .getImportedPath ( ) }
118+ private predicate shouldResolveExpr ( Expr e ) { e = any ( Import imprt ) .getImportedPathExpr ( ) }
119119
120120private module Resolver = ResolveExpr< shouldResolveExpr / 1 > ;
121121
@@ -127,8 +127,13 @@ abstract class Import extends AstNode {
127127 /** Gets the module in which this import appears. */
128128 abstract Module getEnclosingModule ( ) ;
129129
130+ /** DEPRECATED. Use `getImportedPathExpr` instead. */
131+ deprecated PathExpr getImportedPath ( ) { none ( ) }
132+
130133 /** Gets the (unresolved) path that this import refers to. */
131- abstract PathExpr getImportedPath ( ) ;
134+ abstract Expr getImportedPathExpr ( ) ;
135+
136+ final string getImportedPathString ( ) { result = this .getImportedPathExpr ( ) .getStringValue ( ) }
132137
133138 /**
134139 * Gets an externs module the path of this import resolves to.
@@ -137,13 +142,18 @@ abstract class Import extends AstNode {
137142 * path is assumed to be a possible target of the import.
138143 */
139144 Module resolveExternsImport ( ) {
140- result .isExterns ( ) and result .getName ( ) = this .getImportedPath ( ) . getValue ( )
145+ result .isExterns ( ) and result .getName ( ) = this .getImportedPathString ( )
141146 }
142147
143148 /**
144149 * Gets the module the path of this import resolves to.
145150 */
146- Module resolveImportedPath ( ) { result .getFile ( ) = Resolver:: resolveExpr ( this .getImportedPath ( ) ) }
151+ Module resolveImportedPath ( ) { result .getFile ( ) = this .getTargetFile ( ) }
152+
153+ /**
154+ * Gets the module the path of this import resolves to.
155+ */
156+ File getTargetFile ( ) { result = Resolver:: resolveExpr ( this .getImportedPathExpr ( ) ) }
147157
148158 /**
149159 * DEPRECATED. Use `getImportedModule()` instead.
0 commit comments