Skip to content

Commit 60ad54a

Browse files
committed
Revert "Temp: changes to Module to enable MRVA query"
This reverts commit 506993a.
1 parent 506993a commit 60ad54a

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

javascript/ql/lib/semmle/javascript/Modules.qll

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,6 @@ abstract class Import extends AstNode {
140140
* Gets the module the path of this import resolves to.
141141
*/
142142
Module resolveImportedPath() {
143-
result.getFile() = this.getEnclosingModule().resolve(this.getImportedPath())
144-
}
145-
146-
/**
147-
* Gets the module the path of this import resolves to.
148-
*/
149-
Module resolveImportedPathNew() {
150143
result.getFile() = PathExprResolver::resolvePathExpr(this.getImportedPath())
151144
}
152145

@@ -176,9 +169,9 @@ abstract class Import extends AstNode {
176169
}
177170

178171
/**
179-
* Gets the imported module, as determined by the TypeScript compiler, if any.
172+
* DEPRECATED. Use `getImportedModule()` instead.
180173
*/
181-
Module resolveFromTypeScriptSymbol() {
174+
deprecated Module resolveFromTypeScriptSymbol() {
182175
exists(CanonicalName symbol |
183176
ast_node_symbol(this, symbol) and
184177
ast_node_symbol(result, symbol)
@@ -200,10 +193,8 @@ abstract class Import extends AstNode {
200193
then result = this.resolveExternsImport()
201194
else (
202195
result = this.resolveAsProvidedModule() or
203-
result = this.resolveImportedPathNew() or
204-
result = this.resolveFromTypeRoot() or
205-
// result = this.resolveFromTypeScriptSymbol() or
206-
result = resolveNeighbourPackage(this.getImportedPath().getValue())
196+
result = this.resolveImportedPath() or
197+
result = this.resolveFromTypeRoot()
207198
)
208199
}
209200

@@ -212,28 +203,3 @@ abstract class Import extends AstNode {
212203
*/
213204
abstract DataFlow::Node getImportedModuleNode();
214205
}
215-
216-
/**
217-
* Gets a module imported from another package in the same repository.
218-
*
219-
* No support for importing from folders inside the other package.
220-
*/
221-
Module resolveNeighbourPackage(PathString importPath) {
222-
exists(PackageJson json | importPath = json.getPackageName() and result = json.getMainModule())
223-
or
224-
exists(string package |
225-
result.getFile().getParentContainer() = getPackageFolder(package) and
226-
importPath = package + "/" + [result.getFile().getBaseName(), result.getFile().getStem()]
227-
)
228-
}
229-
230-
/**
231-
* Gets the folder for a package that has name `package` according to a package.json file in the resulting folder.
232-
*/
233-
pragma[noinline]
234-
private Folder getPackageFolder(string package) {
235-
exists(PackageJson json |
236-
json.getPackageName() = package and
237-
result = json.getFile().getParentContainer()
238-
)
239-
}

0 commit comments

Comments
 (0)