addressed CR feedback

This commit is contained in:
Vladimir Matveev 2015-02-24 18:31:53 -08:00
parent 92dddd099a
commit 0d781d8b29
2 changed files with 11 additions and 15 deletions

View file

@ -2765,7 +2765,7 @@ module ts {
return emptyArray; return emptyArray;
} }
return mapToArray(module.exports) return mapToArray(getExportsOfModule(module))
} }
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {

View file

@ -2408,7 +2408,7 @@ module ts {
// try to show exported member for imported module // try to show exported member for imported module
isMemberCompletion = true; isMemberCompletion = true;
isNewIdentifierLocation = true; isNewIdentifierLocation = true;
if (canShowCompletionInImportsClause(previousToken)) { if (showCompletionsInImportsClause(previousToken)) {
var importDeclaration = <ImportDeclaration>getAncestor(previousToken, SyntaxKind.ImportDeclaration); var importDeclaration = <ImportDeclaration>getAncestor(previousToken, SyntaxKind.ImportDeclaration);
Debug.assert(importDeclaration !== undefined); Debug.assert(importDeclaration !== undefined);
var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration);
@ -2466,11 +2466,13 @@ module ts {
return result; return result;
} }
function canShowCompletionInImportsClause(node: Node): boolean { function showCompletionsInImportsClause(node: Node): boolean {
// import {| if (node) {
// import {a,| // import {|
if (node.kind === SyntaxKind.OpenBraceToken || node.kind === SyntaxKind.CommaToken) { // import {a,|
return node.parent.kind === SyntaxKind.NamedImports; if (node.kind === SyntaxKind.OpenBraceToken || node.kind === SyntaxKind.CommaToken) {
return node.parent.kind === SyntaxKind.NamedImports;
}
} }
return false; return false;
@ -2687,17 +2689,13 @@ module ts {
return false; return false;
} }
function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[]{ function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[] {
var exisingImports: Map<boolean> = {}; var exisingImports: Map<boolean> = {};
if (!importDeclaration.importClause) { if (!importDeclaration.importClause) {
return exports; return exports;
} }
if (importDeclaration.importClause.name) {
exisingImports[importDeclaration.importClause.name.text] = true;
}
if (importDeclaration.importClause.namedBindings && if (importDeclaration.importClause.namedBindings &&
importDeclaration.importClause.namedBindings.kind === SyntaxKind.NamedImports) { importDeclaration.importClause.namedBindings.kind === SyntaxKind.NamedImports) {
@ -2710,9 +2708,7 @@ module ts {
if (isEmpty(exisingImports)) { if (isEmpty(exisingImports)) {
return exports; 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[] { function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {