Skip to content

Commit ff1326c

Browse files
committed
JS: Cache getReExportedModule
1 parent 710cca5 commit ff1326c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

javascript/ql/src/semmle/javascript/ES2015Modules.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** Provides classes for working with ECMAScript 2015 modules. */
22

33
import javascript
4+
private import semmle.javascript.internal.CachedStages
45

56
/**
67
* An ECMAScript 2015 module.
@@ -654,7 +655,9 @@ abstract class ReExportDeclaration extends ExportDeclaration {
654655
ES2015Module getReExportedES2015Module() { result = getReExportedModule() }
655656

656657
/** Gets the module from which this declaration re-exports. */
658+
cached
657659
Module getReExportedModule() {
660+
Stages::Imports::ref() and
658661
result.getFile() = getEnclosingModule().resolve(getImportedPath().(PathExpr))
659662
or
660663
result = resolveFromTypeRoot()

javascript/ql/src/semmle/javascript/internal/CachedStages.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ module Stages {
162162
exists(any(Import i).getImportedModule())
163163
or
164164
exists(DataFlow::moduleImport(_))
165+
or
166+
exists(any(ReExportDeclaration d).getReExportedModule())
165167
}
166168
}
167169

0 commit comments

Comments
 (0)