@@ -320,16 +320,6 @@ namespace ts {
320
320
}
321
321
}
322
322
323
- function setValueDeclaration ( symbol : Symbol , node : Declaration ) : void {
324
- const { valueDeclaration } = symbol ;
325
- if ( ! valueDeclaration ||
326
- ( isAssignmentDeclaration ( valueDeclaration ) && ! isAssignmentDeclaration ( node ) ) ||
327
- ( valueDeclaration . kind !== node . kind && isEffectiveModuleDeclaration ( valueDeclaration ) ) ) {
328
- // other kinds of value declarations take precedence over modules and assignment declarations
329
- symbol . valueDeclaration = node ;
330
- }
331
- }
332
-
333
323
// Should not be called on a declaration with a computed property name,
334
324
// unless it is a well known Symbol.
335
325
function getDeclarationName ( node : Declaration ) : __String | undefined {
@@ -423,7 +413,7 @@ namespace ts {
423
413
function declareSymbol ( symbolTable : SymbolTable , parent : Symbol | undefined , node : Declaration , includes : SymbolFlags , excludes : SymbolFlags , isReplaceableByMethod ?: boolean ) : Symbol {
424
414
Debug . assert ( ! hasDynamicName ( node ) ) ;
425
415
426
- const isDefaultExport = hasModifier ( node , ModifierFlags . Default ) ;
416
+ const isDefaultExport = hasModifier ( node , ModifierFlags . Default ) || isExportSpecifier ( node ) && node . name . escapedText === "default" ;
427
417
428
418
// The exported symbol for an export default function/class node is always named "default"
429
419
const name = isDefaultExport && parent ? InternalSymbolName . Default : getDeclarationName ( node ) ;
@@ -659,7 +649,7 @@ namespace ts {
659
649
}
660
650
// We create a return control flow graph for IIFEs and constructors. For constructors
661
651
// we use the return control flow graph in strict property initialization checks.
662
- currentReturnTarget = isIIFE || node . kind === SyntaxKind . Constructor ? createBranchLabel ( ) : undefined ;
652
+ currentReturnTarget = isIIFE || node . kind === SyntaxKind . Constructor || ( isInJSFile && ( node . kind === SyntaxKind . FunctionDeclaration || node . kind === SyntaxKind . FunctionExpression ) ) ? createBranchLabel ( ) : undefined ;
663
653
currentExceptionTarget = undefined ;
664
654
currentBreakTarget = undefined ;
665
655
currentContinueTarget = undefined ;
@@ -680,8 +670,8 @@ namespace ts {
680
670
if ( currentReturnTarget ) {
681
671
addAntecedent ( currentReturnTarget , currentFlow ) ;
682
672
currentFlow = finishFlowLabel ( currentReturnTarget ) ;
683
- if ( node . kind === SyntaxKind . Constructor ) {
684
- ( < ConstructorDeclaration > node ) . returnFlowNode = currentFlow ;
673
+ if ( node . kind === SyntaxKind . Constructor || ( isInJSFile && ( node . kind === SyntaxKind . FunctionDeclaration || node . kind === SyntaxKind . FunctionExpression ) ) ) {
674
+ ( < FunctionLikeDeclaration > node ) . returnFlowNode = currentFlow ;
685
675
}
686
676
}
687
677
if ( ! isIIFE ) {
@@ -2974,7 +2964,7 @@ namespace ts {
2974
2964
2975
2965
function bindSpecialPropertyAssignment ( node : BindablePropertyAssignmentExpression ) {
2976
2966
// Class declarations in Typescript do not allow property declarations
2977
- const parentSymbol = lookupSymbolForPropertyAccess ( node . left . expression ) ;
2967
+ const parentSymbol = lookupSymbolForPropertyAccess ( node . left . expression , container ) || lookupSymbolForPropertyAccess ( node . left . expression , blockScopeContainer ) ;
2978
2968
if ( ! isInJSFile ( node ) && ! isFunctionSymbol ( parentSymbol ) ) {
2979
2969
return ;
2980
2970
}
@@ -3083,7 +3073,7 @@ namespace ts {
3083
3073
}
3084
3074
3085
3075
function bindPropertyAssignment ( name : BindableStaticNameExpression , propertyAccess : BindableStaticAccessExpression , isPrototypeProperty : boolean , containerIsClass : boolean ) {
3086
- let namespaceSymbol = lookupSymbolForPropertyAccess ( name ) ;
3076
+ let namespaceSymbol = lookupSymbolForPropertyAccess ( name , container ) || lookupSymbolForPropertyAccess ( name , blockScopeContainer ) ;
3087
3077
const isToplevel = isTopLevelNamespaceAssignment ( propertyAccess ) ;
3088
3078
namespaceSymbol = bindPotentiallyMissingNamespaces ( namespaceSymbol , propertyAccess . expression , isToplevel , isPrototypeProperty , containerIsClass ) ;
3089
3079
bindPotentiallyNewExpandoMemberToNamespace ( propertyAccess , namespaceSymbol , isPrototypeProperty ) ;
0 commit comments