From 0d781d8b29d529d4000563c9d047f02b9a2ad8a8 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 24 Feb 2015 18:31:53 -0800 Subject: [PATCH] addressed CR feedback --- src/compiler/checker.ts | 2 +- src/services/services.ts | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9ec87743577..309c3116b35 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2765,7 +2765,7 @@ module ts { return emptyArray; } - return mapToArray(module.exports) + return mapToArray(getExportsOfModule(module)) } function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { diff --git a/src/services/services.ts b/src/services/services.ts index a8caa805382..0b23b134bc5 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2408,7 +2408,7 @@ module ts { // try to show exported member for imported module isMemberCompletion = true; isNewIdentifierLocation = true; - if (canShowCompletionInImportsClause(previousToken)) { + if (showCompletionsInImportsClause(previousToken)) { var importDeclaration = getAncestor(previousToken, SyntaxKind.ImportDeclaration); Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); @@ -2466,11 +2466,13 @@ module ts { return result; } - function canShowCompletionInImportsClause(node: Node): boolean { - // import {| - // import {a,| - if (node.kind === SyntaxKind.OpenBraceToken || node.kind === SyntaxKind.CommaToken) { - return node.parent.kind === SyntaxKind.NamedImports; + function showCompletionsInImportsClause(node: Node): boolean { + if (node) { + // import {| + // import {a,| + if (node.kind === SyntaxKind.OpenBraceToken || node.kind === SyntaxKind.CommaToken) { + return node.parent.kind === SyntaxKind.NamedImports; + } } return false; @@ -2687,17 +2689,13 @@ module ts { return false; } - function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[]{ + function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[] { var exisingImports: Map = {}; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.name) { - exisingImports[importDeclaration.importClause.name.text] = true; - } - if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === SyntaxKind.NamedImports) { @@ -2710,9 +2708,7 @@ module ts { if (isEmpty(exisingImports)) { return exports; } - else { - return filter(exports, e => !lookUp(exisingImports, e.name)); - } + return filter(exports, e => !lookUp(exisingImports, e.name)); } function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {