@@ -288,7 +288,7 @@ namespace ts {
288
288
// module.exports = ...
289
289
return InternalSymbolName . ExportEquals ;
290
290
case SyntaxKind . BinaryExpression :
291
- if ( getSpecialPropertyAssignmentKind ( node as BinaryExpression ) === SpecialPropertyAssignmentKind . ModuleExports ) {
291
+ if ( getAssignmentDeclarationKind ( node as BinaryExpression ) === AssignmentDeclarationKind . ModuleExports ) {
292
292
// module.exports = ...
293
293
return InternalSymbolName . ExportEquals ;
294
294
}
@@ -374,8 +374,8 @@ namespace ts {
374
374
// prototype symbols like methods.
375
375
symbolTable . set ( name , symbol = createSymbol ( SymbolFlags . None , name ) ) ;
376
376
}
377
- else if ( ! ( includes & SymbolFlags . Variable && symbol . flags & SymbolFlags . JSContainer ) ) {
378
- // JSContainers are allowed to merge with variables, no matter what other flags they have.
377
+ else if ( ! ( includes & SymbolFlags . Variable && symbol . flags & SymbolFlags . Assignment ) ) {
378
+ // Assignment declarations are allowed to merge with variables, no matter what other flags they have.
379
379
if ( isNamedDeclaration ( node ) ) {
380
380
node . name . parent = node ;
381
381
}
@@ -461,7 +461,7 @@ namespace ts {
461
461
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
462
462
// and this case is specially handled. Module augmentations should only be merged with original module definition
463
463
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
464
- if ( isJSDocTypeAlias ( node ) ) Debug . assert ( isInJavaScriptFile ( node ) ) ; // We shouldn't add symbols for JSDoc nodes if not in a JS file.
464
+ if ( isJSDocTypeAlias ( node ) ) Debug . assert ( isInJSFile ( node ) ) ; // We shouldn't add symbols for JSDoc nodes if not in a JS file.
465
465
if ( ( ! isAmbientModule ( node ) && ( hasExportModifier || container . flags & NodeFlags . ExportContext ) ) || isJSDocTypeAlias ( node ) ) {
466
466
if ( hasModifier ( node , ModifierFlags . Default ) && ! getDeclarationName ( node ) ) {
467
467
return declareSymbol ( container . symbol . exports ! , container . symbol , node , symbolFlags , symbolExcludes ) ; // No local symbol for an unnamed default!
@@ -2009,7 +2009,7 @@ namespace ts {
2009
2009
2010
2010
function bindJSDoc ( node : Node ) {
2011
2011
if ( hasJSDocNodes ( node ) ) {
2012
- if ( isInJavaScriptFile ( node ) ) {
2012
+ if ( isInJSFile ( node ) ) {
2013
2013
for ( const j of node . jsDoc ! ) {
2014
2014
bind ( j ) ;
2015
2015
}
@@ -2075,7 +2075,7 @@ namespace ts {
2075
2075
if ( isSpecialPropertyDeclaration ( node as PropertyAccessExpression ) ) {
2076
2076
bindSpecialPropertyDeclaration ( node as PropertyAccessExpression ) ;
2077
2077
}
2078
- if ( isInJavaScriptFile ( node ) &&
2078
+ if ( isInJSFile ( node ) &&
2079
2079
file . commonJsModuleIndicator &&
2080
2080
isModuleExportsPropertyAccessExpression ( node as PropertyAccessExpression ) &&
2081
2081
! lookupSymbolForNameWorker ( blockScopeContainer , "module" as __String ) ) {
@@ -2084,27 +2084,27 @@ namespace ts {
2084
2084
}
2085
2085
break ;
2086
2086
case SyntaxKind . BinaryExpression :
2087
- const specialKind = getSpecialPropertyAssignmentKind ( node as BinaryExpression ) ;
2087
+ const specialKind = getAssignmentDeclarationKind ( node as BinaryExpression ) ;
2088
2088
switch ( specialKind ) {
2089
- case SpecialPropertyAssignmentKind . ExportsProperty :
2089
+ case AssignmentDeclarationKind . ExportsProperty :
2090
2090
bindExportsPropertyAssignment ( node as BinaryExpression ) ;
2091
2091
break ;
2092
- case SpecialPropertyAssignmentKind . ModuleExports :
2092
+ case AssignmentDeclarationKind . ModuleExports :
2093
2093
bindModuleExportsAssignment ( node as BinaryExpression ) ;
2094
2094
break ;
2095
- case SpecialPropertyAssignmentKind . PrototypeProperty :
2095
+ case AssignmentDeclarationKind . PrototypeProperty :
2096
2096
bindPrototypePropertyAssignment ( ( node as BinaryExpression ) . left as PropertyAccessEntityNameExpression , node ) ;
2097
2097
break ;
2098
- case SpecialPropertyAssignmentKind . Prototype :
2098
+ case AssignmentDeclarationKind . Prototype :
2099
2099
bindPrototypeAssignment ( node as BinaryExpression ) ;
2100
2100
break ;
2101
- case SpecialPropertyAssignmentKind . ThisProperty :
2101
+ case AssignmentDeclarationKind . ThisProperty :
2102
2102
bindThisPropertyAssignment ( node as BinaryExpression ) ;
2103
2103
break ;
2104
- case SpecialPropertyAssignmentKind . Property :
2104
+ case AssignmentDeclarationKind . Property :
2105
2105
bindSpecialPropertyAssignment ( node as BinaryExpression ) ;
2106
2106
break ;
2107
- case SpecialPropertyAssignmentKind . None :
2107
+ case AssignmentDeclarationKind . None :
2108
2108
// Nothing to do
2109
2109
break ;
2110
2110
default :
@@ -2184,7 +2184,7 @@ namespace ts {
2184
2184
return bindFunctionExpression ( < FunctionExpression > node ) ;
2185
2185
2186
2186
case SyntaxKind . CallExpression :
2187
- if ( isInJavaScriptFile ( node ) ) {
2187
+ if ( isInJSFile ( node ) ) {
2188
2188
bindCallExpression ( < CallExpression > node ) ;
2189
2189
}
2190
2190
break ;
@@ -2361,7 +2361,7 @@ namespace ts {
2361
2361
const lhs = node . left as PropertyAccessEntityNameExpression ;
2362
2362
const symbol = forEachIdentifierInEntityName ( lhs . expression , /*parent*/ undefined , ( id , symbol ) => {
2363
2363
if ( symbol ) {
2364
- addDeclarationToSymbol ( symbol , id , SymbolFlags . Module | SymbolFlags . JSContainer ) ;
2364
+ addDeclarationToSymbol ( symbol , id , SymbolFlags . Module | SymbolFlags . Assignment ) ;
2365
2365
}
2366
2366
return symbol ;
2367
2367
} ) ;
@@ -2394,7 +2394,7 @@ namespace ts {
2394
2394
}
2395
2395
2396
2396
function bindThisPropertyAssignment ( node : BinaryExpression | PropertyAccessExpression ) {
2397
- Debug . assert ( isInJavaScriptFile ( node ) ) ;
2397
+ Debug . assert ( isInJSFile ( node ) ) ;
2398
2398
const thisContainer = getThisContainer ( node , /*includeArrowFunctions*/ false ) ;
2399
2399
switch ( thisContainer . kind ) {
2400
2400
case SyntaxKind . FunctionDeclaration :
@@ -2482,7 +2482,7 @@ namespace ts {
2482
2482
const lhs = node . left as PropertyAccessEntityNameExpression ;
2483
2483
// Class declarations in Typescript do not allow property declarations
2484
2484
const parentSymbol = lookupSymbolForPropertyAccess ( lhs . expression ) ;
2485
- if ( ! isInJavaScriptFile ( node ) && ! isFunctionSymbol ( parentSymbol ) ) {
2485
+ if ( ! isInJSFile ( node ) && ! isFunctionSymbol ( parentSymbol ) ) {
2486
2486
return ;
2487
2487
}
2488
2488
// Fix up parent pointers since we're going to use these nodes before we bind into them
@@ -2515,8 +2515,8 @@ namespace ts {
2515
2515
: propertyAccess . parent . parent . kind === SyntaxKind . SourceFile ;
2516
2516
if ( ! isPrototypeProperty && ( ! namespaceSymbol || ! ( namespaceSymbol . flags & SymbolFlags . Namespace ) ) && isToplevel ) {
2517
2517
// make symbols or add declarations for intermediate containers
2518
- const flags = SymbolFlags . Module | SymbolFlags . JSContainer ;
2519
- const excludeFlags = SymbolFlags . ValueModuleExcludes & ~ SymbolFlags . JSContainer ;
2518
+ const flags = SymbolFlags . Module | SymbolFlags . Assignment ;
2519
+ const excludeFlags = SymbolFlags . ValueModuleExcludes & ~ SymbolFlags . Assignment ;
2520
2520
namespaceSymbol = forEachIdentifierInEntityName ( propertyAccess . expression , namespaceSymbol , ( id , symbol , parent ) => {
2521
2521
if ( symbol ) {
2522
2522
addDeclarationToSymbol ( symbol , id , flags ) ;
@@ -2527,7 +2527,7 @@ namespace ts {
2527
2527
}
2528
2528
} ) ;
2529
2529
}
2530
- if ( ! namespaceSymbol || ! isJavascriptContainer ( namespaceSymbol ) ) {
2530
+ if ( ! namespaceSymbol || ! isExpandoSymbol ( namespaceSymbol ) ) {
2531
2531
return ;
2532
2532
}
2533
2533
@@ -2536,14 +2536,14 @@ namespace ts {
2536
2536
( namespaceSymbol . members || ( namespaceSymbol . members = createSymbolTable ( ) ) ) :
2537
2537
( namespaceSymbol . exports || ( namespaceSymbol . exports = createSymbolTable ( ) ) ) ;
2538
2538
2539
- const isMethod = isFunctionLikeDeclaration ( getAssignedJavascriptInitializer ( propertyAccess ) ! ) ;
2539
+ const isMethod = isFunctionLikeDeclaration ( getAssignedExpandoInitializer ( propertyAccess ) ! ) ;
2540
2540
const includes = isMethod ? SymbolFlags . Method : SymbolFlags . Property ;
2541
2541
const excludes = isMethod ? SymbolFlags . MethodExcludes : SymbolFlags . PropertyExcludes ;
2542
- declareSymbol ( symbolTable , namespaceSymbol , propertyAccess , includes | SymbolFlags . JSContainer , excludes & ~ SymbolFlags . JSContainer ) ;
2542
+ declareSymbol ( symbolTable , namespaceSymbol , propertyAccess , includes | SymbolFlags . Assignment , excludes & ~ SymbolFlags . Assignment ) ;
2543
2543
}
2544
2544
2545
2545
/**
2546
- * Javascript containers are:
2546
+ * Javascript expando values are:
2547
2547
* - Functions
2548
2548
* - classes
2549
2549
* - namespaces
@@ -2552,7 +2552,7 @@ namespace ts {
2552
2552
* - with empty object literals
2553
2553
* - with non-empty object literals if assigned to the prototype property
2554
2554
*/
2555
- function isJavascriptContainer ( symbol : Symbol ) : boolean {
2555
+ function isExpandoSymbol ( symbol : Symbol ) : boolean {
2556
2556
if ( symbol . flags & ( SymbolFlags . Function | SymbolFlags . Class | SymbolFlags . NamespaceModule ) ) {
2557
2557
return true ;
2558
2558
}
@@ -2565,7 +2565,7 @@ namespace ts {
2565
2565
init = init && getRightMostAssignedExpression ( init ) ;
2566
2566
if ( init ) {
2567
2567
const isPrototypeAssignment = isPrototypeAccess ( isVariableDeclaration ( node ) ? node . name : isBinaryExpression ( node ) ? node . left : node ) ;
2568
- return ! ! getJavascriptInitializer ( isBinaryExpression ( init ) && init . operatorToken . kind === SyntaxKind . BarBarToken ? init . right : init , isPrototypeAssignment ) ;
2568
+ return ! ! getExpandoInitializer ( isBinaryExpression ( init ) && init . operatorToken . kind === SyntaxKind . BarBarToken ? init . right : init , isPrototypeAssignment ) ;
2569
2569
}
2570
2570
return false ;
2571
2571
}
0 commit comments