File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ private predicate hasDefaultExport(ES2015Module mod) {
9292class ImportDeclaration extends Stmt , Import , @import_declaration {
9393 override ES2015Module getEnclosingModule ( ) { result = this .getTopLevel ( ) }
9494
95+ /**
96+ * Internal use only. Use `getImportedPathExpr` instead.
97+ */
98+ string getRawImportPath ( ) { result = this .getChildExpr ( - 1 ) .getStringValue ( ) }
99+
95100 override Expr getImportedPathExpr ( ) { result = this .getChildExpr ( - 1 ) }
96101
97102 /**
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ private class RequireVariable extends Variable {
237237}
238238
239239private predicate isModuleModule ( EarlyStageNode nd ) {
240- exists ( ImportDeclaration imp | imp .getImportedPathString ( ) = "module" |
240+ exists ( ImportDeclaration imp | imp .getRawImportPath ( ) = "module" |
241241 nd = TDestructuredModuleImportNode ( imp )
242242 or
243243 nd = TValueNode ( imp .getASpecifier ( ) .( ImportNamespaceSpecifier ) )
@@ -263,7 +263,7 @@ private predicate isCreateRequire(EarlyStageNode nd) {
263263 )
264264 or
265265 exists ( ImportDeclaration decl , NamedImportSpecifier spec |
266- decl .getImportedPathString ( ) = "module" and
266+ decl .getRawImportPath ( ) = "module" and
267267 spec = decl .getASpecifier ( ) and
268268 spec .getImportedName ( ) = "createRequire" and
269269 nd = TValueNode ( spec )
You can’t perform that action at this time.
0 commit comments