@@ -11809,16 +11809,11 @@ module ts {
11809
11809
}
11810
11810
}
11811
11811
11812
- // When resolved as an expression identifier, if the given node references a default import or a named import, return
11813
- // the declaration node of that import. Otherwise, return undefined.
11814
- function getReferencedImportDeclaration(node: Identifier): ImportClause | ImportSpecifier {
11812
+ // When resolved as an expression identifier, if the given node references an import, return the declaration of
11813
+ // that import. Otherwise, return undefined.
11814
+ function getReferencedImportDeclaration(node: Identifier): Declaration {
11815
11815
let symbol = getReferencedValueSymbol(node);
11816
- if (symbol && symbol.flags & SymbolFlags.Alias) {
11817
- let declaration = getDeclarationOfAliasSymbol(symbol);
11818
- if (declaration.kind === SyntaxKind.ImportClause || declaration.kind === SyntaxKind.ImportSpecifier) {
11819
- return <ImportClause | ImportSpecifier>declaration;
11820
- }
11821
- }
11816
+ return symbol && symbol.flags & SymbolFlags.Alias ? getDeclarationOfAliasSymbol(symbol) : undefined;
11822
11817
}
11823
11818
11824
11819
function isStatementWithLocals(node: Node) {
@@ -11833,24 +11828,30 @@ module ts {
11833
11828
return false;
11834
11829
}
11835
11830
11836
- function getIsNestedRedeclaration(symbol: Symbol): boolean {
11837
- let links = getSymbolLinks(symbol);
11838
- if (links.isNestedRedeclaration === undefined) {
11839
- let container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
11840
- links.isNestedRedeclaration = isStatementWithLocals(container) &&
11841
- !!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
11831
+ function isNestedRedeclarationSymbol(symbol: Symbol): boolean {
11832
+ if (symbol.flags & SymbolFlags.BlockScoped) {
11833
+ let links = getSymbolLinks(symbol);
11834
+ if (links.isNestedRedeclaration === undefined) {
11835
+ let container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
11836
+ links.isNestedRedeclaration = isStatementWithLocals(container) &&
11837
+ !!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
11838
+ }
11839
+ return links.isNestedRedeclaration;
11842
11840
}
11843
- return links.isNestedRedeclaration ;
11841
+ return false ;
11844
11842
}
11845
11843
11844
+ // When resolved as an expression identifier, if the given node references a nested block scoped entity with
11845
+ // a name that hides an existing name, return the declaration of that entity. Otherwise, return undefined.
11846
11846
function getReferencedNestedRedeclaration(node: Identifier): Declaration {
11847
11847
let symbol = getReferencedValueSymbol(node);
11848
- return symbol && symbol.flags & SymbolFlags.BlockScoped && getIsNestedRedeclaration (symbol) ? symbol.valueDeclaration : undefined;
11848
+ return symbol && isNestedRedeclarationSymbol (symbol) ? symbol.valueDeclaration : undefined;
11849
11849
}
11850
11850
11851
+ // Return true if the given node is a declaration of a nested block scoped entity with a name that hides an
11852
+ // existing name.
11851
11853
function isNestedRedeclaration(node: Declaration): boolean {
11852
- let symbol = getSymbolOfNode(node);
11853
- return symbol.flags & SymbolFlags.BlockScoped && getIsNestedRedeclaration(symbol);
11854
+ return isNestedRedeclarationSymbol(getSymbolOfNode(node));
11854
11855
}
11855
11856
11856
11857
function isValueAliasDeclaration(node: Node): boolean {
0 commit comments