@@ -6737,6 +6737,21 @@ module ts {
6737
6737
return false ;
6738
6738
}
6739
6739
6740
+ function isInRightSideOfImportOrExportAssignment ( node : EntityName ) {
6741
+ while ( node . parent . kind === SyntaxKind . QualifiedName ) {
6742
+ node = node . parent ;
6743
+ }
6744
+
6745
+ if ( node . parent . kind === SyntaxKind . ImportDeclaration ) {
6746
+ return ( < ImportDeclaration > node . parent ) . entityName === node ;
6747
+ }
6748
+ if ( node . parent . kind === SyntaxKind . ExportAssignment ) {
6749
+ return ( < ExportAssignment > node . parent ) . exportName === node ;
6750
+ }
6751
+
6752
+ return false ;
6753
+ }
6754
+
6740
6755
function isRightSideOfQualifiedNameOrPropertyAccess ( node : Node ) {
6741
6756
return ( node . parent . kind === SyntaxKind . QualifiedName || node . parent . kind === SyntaxKind . PropertyAccess ) &&
6742
6757
( < QualifiedName > node . parent ) . right === node ;
@@ -6747,6 +6762,11 @@ module ts {
6747
6762
return getSymbolOfNode ( identifier . parent ) ;
6748
6763
}
6749
6764
6765
+ if ( identifier . parent . kind === SyntaxKind . ExportAssignment ) {
6766
+ return resolveEntityName ( /*location*/ identifier . parent . parent , identifier ,
6767
+ /*all meanings*/ SymbolFlags . Value | SymbolFlags . Type | SymbolFlags . Namespace | SymbolFlags . Import ) ;
6768
+ }
6769
+
6750
6770
var entityName : Node = identifier ;
6751
6771
while ( isRightSideOfQualifiedNameOrPropertyAccess ( entityName ) )
6752
6772
entityName = entityName . parent ;
@@ -6855,13 +6875,23 @@ module ts {
6855
6875
return getTypeOfSymbol ( symbol ) ;
6856
6876
}
6857
6877
6858
- if ( node . kind === SyntaxKind . Identifier && node . parent . kind === SyntaxKind . ExportAssignment ) {
6859
- var symbol = getSymbolInfo ( node ) ;
6878
+ if ( isInRightSideOfImportOrExportAssignment ( node ) ) {
6879
+ var symbol : Symbol ;
6880
+ if ( node . parent . kind === SyntaxKind . ExportAssignment ) {
6881
+ symbol = getSymbolInfo ( node ) ;
6882
+ }
6883
+ else {
6884
+ // It is an import statement
6885
+ while ( node . kind !== SyntaxKind . ImportDeclaration ) {
6886
+ node = node . parent ;
6887
+ }
6888
+ symbol = getSymbolOfNode ( node ) ;
6889
+ }
6860
6890
var declaredType = getDeclaredTypeOfSymbol ( symbol ) ;
6861
6891
return declaredType !== unknownType ? declaredType : getTypeOfSymbol ( symbol ) ;
6862
6892
}
6863
6893
6864
- Debug . fail ( "Unhandled case in getTypeOfNode" ) ;
6894
+ return unknownType ;
6865
6895
}
6866
6896
6867
6897
function getTypeOfExpression ( expr : Expression ) : Type {
0 commit comments