Fixed transitive export completion list issue.

This commit is contained in:
Daniel Rosenwasser 2015-03-24 18:45:22 -07:00
parent 2de0a974bb
commit fd3b4ca9cd
3 changed files with 15 additions and 7 deletions

View File

@ -74,7 +74,10 @@ module ts {
isImplementationOfOverload,
getAliasedSymbol: resolveAlias,
getEmitResolver,
getExportsOfExternalModule,
getExportsOfImportDeclaration,
getExportsOfModule(moduleSymbol: Symbol): Symbol[] {
return mapToArray(getExportsOfModule(moduleSymbol));
}
};
let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown");
@ -794,6 +797,7 @@ module ts {
}
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
// TODO (drosen): Why do we not use getExportsOfModule for exteral modules as weel?
return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports;
}
@ -2921,7 +2925,7 @@ module ts {
return result;
}
function getExportsOfExternalModule(node: ImportDeclaration): Symbol[]{
function getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[] {
if (!node.moduleSpecifier) {
return emptyArray;
}

View File

@ -902,7 +902,7 @@ module ts {
// import "mod" => importClause = undefined, moduleSpecifier = "mod"
// In rest of the cases, module specifier is string literal corresponding to module
// ImportClause information is shown at its declaration below.
export interface ImportDeclaration extends Statement, ModuleElement {
export interface ImportDeclaration extends ModuleElement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
@ -1115,7 +1115,8 @@ module ts {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
getAliasedSymbol(symbol: Symbol): Symbol;
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
getExportsOfImportDeclaration(node: ImportDeclaration): Symbol[];
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
// Should not be called directly. Should only be accessed through the Program instance.
/* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[];

View File

@ -2533,8 +2533,10 @@ module ts {
if (symbol && symbol.flags & SymbolFlags.HasExports) {
// Extract module or enum members
forEachValue(symbol.exports, symbol => {
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
let exportedMembers = typeInfoResolver.getExportsOfModule(symbol);
forEach(exportedMembers, symbol => {
if (!(symbol.flags & SymbolFlags.ExportStar)
&& typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
symbols.push(symbol);
}
});
@ -2577,7 +2579,8 @@ module ts {
if (showCompletionsInImportsClause(previousToken)) {
let importDeclaration = <ImportDeclaration>getAncestor(previousToken, SyntaxKind.ImportDeclaration);
Debug.assert(importDeclaration !== undefined);
let exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration);
let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration);
symbols = filterModuleExports(exports, importDeclaration);
}
}