mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
JS: Cache getReExportedModule
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/** Provides classes for working with ECMAScript 2015 modules. */
|
||||
|
||||
import javascript
|
||||
private import semmle.javascript.internal.CachedStages
|
||||
|
||||
/**
|
||||
* An ECMAScript 2015 module.
|
||||
@@ -654,7 +655,9 @@ abstract class ReExportDeclaration extends ExportDeclaration {
|
||||
ES2015Module getReExportedES2015Module() { result = getReExportedModule() }
|
||||
|
||||
/** Gets the module from which this declaration re-exports. */
|
||||
cached
|
||||
Module getReExportedModule() {
|
||||
Stages::Imports::ref() and
|
||||
result.getFile() = getEnclosingModule().resolve(getImportedPath().(PathExpr))
|
||||
or
|
||||
result = resolveFromTypeRoot()
|
||||
|
||||
@@ -162,6 +162,8 @@ module Stages {
|
||||
exists(any(Import i).getImportedModule())
|
||||
or
|
||||
exists(DataFlow::moduleImport(_))
|
||||
or
|
||||
exists(any(ReExportDeclaration d).getReExportedModule())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user