Skip to content

Commit

Permalink
Fixed bug in import resolver. It was incorrectly returning implicit i…
Browse files Browse the repository at this point in the history
…mports for "import X" or "import X as Y" statements.
  • Loading branch information
msfterictraut committed Feb 18, 2020
1 parent e7b221e commit 25758b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 7 additions & 1 deletion server/src/analyzer/importResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,13 @@ export class ImportResolver {
// Potentially modifies the ImportResult by removing some or all of the
// implicit import entries. Only the imported symbols should be included.
private _filterImplicitImports(importResult: ImportResult, importedSymbols: string[] | undefined): ImportResult {
if (importedSymbols === undefined || importedSymbols.length === 0) {
if (importedSymbols === undefined) {
const newImportResult = Object.assign({}, importResult);
newImportResult.implicitImports = [];
return newImportResult;
}

if (importedSymbols.length === 0) {
return importResult;
}

Expand Down
6 changes: 2 additions & 4 deletions server/src/analyzer/sourceFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,8 @@ export class SourceFile {
}
}

private _resolveImports(importResolver: ImportResolver,
moduleImports: ModuleImport[],
execEnv: ExecutionEnvironment):
[ImportResult[], ImportResult?, string?, string?] {
private _resolveImports(importResolver: ImportResolver, moduleImports: ModuleImport[],
execEnv: ExecutionEnvironment): [ImportResult[], ImportResult?, string?, string?] {

const imports: ImportResult[] = [];

Expand Down

0 comments on commit 25758b8

Please sign in to comment.