@@ -11,7 +11,7 @@ namespace ts {
11
11
}
12
12
13
13
export function getModuleInstanceState ( node : Node ) : ModuleInstanceState {
14
- // A module is uninstantiated if it contains only
14
+ // A module is uninstantiated if it contains only
15
15
// 1. interface declarations, type alias declarations
16
16
if ( node . kind === SyntaxKind . InterfaceDeclaration || node . kind === SyntaxKind . TypeAliasDeclaration ) {
17
17
return ModuleInstanceState . NonInstantiated ;
@@ -53,7 +53,7 @@ namespace ts {
53
53
}
54
54
55
55
const enum ContainerFlags {
56
- // The current node is not a container, and no container manipulation should happen before
56
+ // The current node is not a container, and no container manipulation should happen before
57
57
// recursing into it.
58
58
None = 0 ,
59
59
@@ -90,13 +90,13 @@ namespace ts {
90
90
let lastContainer : Node ;
91
91
92
92
// If this file is an external module, then it is automatically in strict-mode according to
93
- // ES6. If it is not an external module, then we'll determine if it is in strict mode or
93
+ // ES6. If it is not an external module, then we'll determine if it is in strict mode or
94
94
// not depending on if we see "use strict" in certain places (or if we hit a class/namespace).
95
95
let inStrictMode = ! ! file . externalModuleIndicator ;
96
96
97
97
let symbolCount = 0 ;
98
98
let Symbol = objectAllocator . getSymbolConstructor ( ) ;
99
- let classifiableNames : Map < string > = { } ;
99
+ let classifiableNames : Map < string > = { } ;
100
100
101
101
if ( ! file . locals ) {
102
102
bind ( file ) ;
@@ -179,7 +179,7 @@ namespace ts {
179
179
* @param parent - node's parent declaration.
180
180
* @param node - The declaration to be added to the symbol table
181
181
* @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.)
182
- * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.
182
+ * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.
183
183
*/
184
184
function declareSymbol ( symbolTable : SymbolTable , parent : Symbol , node : Declaration , includes : SymbolFlags , excludes : SymbolFlags ) : Symbol {
185
185
Debug . assert ( ! hasDynamicName ( node ) ) ;
@@ -192,13 +192,13 @@ namespace ts {
192
192
193
193
// Check and see if the symbol table already has a symbol with this name. If not,
194
194
// create a new symbol with this name and add it to the table. Note that we don't
195
- // give the new symbol any flags *yet*. This ensures that it will not conflict
195
+ // give the new symbol any flags *yet*. This ensures that it will not conflict
196
196
// with the 'excludes' flags we pass in.
197
197
//
198
198
// If we do get an existing symbol, see if it conflicts with the new symbol we're
199
199
// creating. For example, a 'var' symbol and a 'class' symbol will conflict within
200
- // the same symbol table. If we have a conflict, report the issue on each
201
- // declaration we have for this symbol, and then create a new symbol for this
200
+ // the same symbol table. If we have a conflict, report the issue on each
201
+ // declaration we have for this symbol, and then create a new symbol for this
202
202
// declaration.
203
203
//
204
204
// If we created a new symbol, either because we didn't have a symbol with this name
@@ -259,7 +259,7 @@ namespace ts {
259
259
// ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set
260
260
// on it. There are 2 main reasons:
261
261
//
262
- // 1. We treat locals and exports of the same name as mutually exclusive within a container.
262
+ // 1. We treat locals and exports of the same name as mutually exclusive within a container.
263
263
// That means the binder will issue a Duplicate Identifier error if you mix locals and exports
264
264
// with the same name in the same container.
265
265
// TODO: Make this a more specific error and decouple it from the exclusion logic.
@@ -282,11 +282,11 @@ namespace ts {
282
282
}
283
283
}
284
284
285
- // All container nodes are kept on a linked list in declaration order. This list is used by
286
- // the getLocalNameOfContainer function in the type checker to validate that the local name
285
+ // All container nodes are kept on a linked list in declaration order. This list is used by
286
+ // the getLocalNameOfContainer function in the type checker to validate that the local name
287
287
// used for a container is unique.
288
288
function bindChildren ( node : Node ) {
289
- // Before we recurse into a node's chilren, we first save the existing parent, container
289
+ // Before we recurse into a node's chilren, we first save the existing parent, container
290
290
// and block-container. Then after we pop out of processing the children, we restore
291
291
// these saved values.
292
292
let saveParent = parent ;
@@ -295,16 +295,16 @@ namespace ts {
295
295
296
296
// This node will now be set as the parent of all of its children as we recurse into them.
297
297
parent = node ;
298
-
298
+
299
299
// Depending on what kind of node this is, we may have to adjust the current container
300
300
// and block-container. If the current node is a container, then it is automatically
301
301
// considered the current block-container as well. Also, for containers that we know
302
302
// may contain locals, we proactively initialize the .locals field. We do this because
303
303
// it's highly likely that the .locals will be needed to place some child in (for example,
304
304
// a parameter, or variable declaration).
305
- //
305
+ //
306
306
// However, we do not proactively create the .locals for block-containers because it's
307
- // totally normal and common for block-containers to never actually have a block-scoped
307
+ // totally normal and common for block-containers to never actually have a block-scoped
308
308
// variable in them. We don't want to end up allocating an object for every 'block' we
309
309
// run into when most of them won't be necessary.
310
310
//
@@ -345,7 +345,7 @@ namespace ts {
345
345
case SyntaxKind . TypeLiteral :
346
346
case SyntaxKind . ObjectLiteralExpression :
347
347
return ContainerFlags . IsContainer ;
348
-
348
+
349
349
case SyntaxKind . CallSignature :
350
350
case SyntaxKind . ConstructSignature :
351
351
case SyntaxKind . IndexSignature :
@@ -373,7 +373,7 @@ namespace ts {
373
373
374
374
case SyntaxKind . Block :
375
375
// do not treat blocks directly inside a function as a block-scoped-container.
376
- // Locals that reside in this block should go to the function locals. Othewise 'x'
376
+ // Locals that reside in this block should go to the function locals. Othewise 'x'
377
377
// would not appear to be a redeclaration of a block scoped local in the following
378
378
// example:
379
379
//
@@ -386,7 +386,7 @@ namespace ts {
386
386
// the block, then there would be no collision.
387
387
//
388
388
// By not creating a new block-scoped-container here, we ensure that both 'var x'
389
- // and 'let x' go into the Function-container's locals, and we do get a collision
389
+ // and 'let x' go into the Function-container's locals, and we do get a collision
390
390
// conflict.
391
391
return isFunctionLike ( node . parent ) ? ContainerFlags . None : ContainerFlags . IsBlockScopedContainer ;
392
392
}
@@ -484,7 +484,7 @@ namespace ts {
484
484
}
485
485
486
486
function hasExportDeclarations ( node : ModuleDeclaration | SourceFile ) : boolean {
487
- var body = node . kind === SyntaxKind . SourceFile ? node : ( < ModuleDeclaration > node ) . body ;
487
+ let body = node . kind === SyntaxKind . SourceFile ? node : ( < ModuleDeclaration > node ) . body ;
488
488
if ( body . kind === SyntaxKind . SourceFile || body . kind === SyntaxKind . ModuleBlock ) {
489
489
for ( let stat of ( < Block > body ) . statements ) {
490
490
if ( stat . kind === SyntaxKind . ExportDeclaration || stat . kind === SyntaxKind . ExportAssignment ) {
@@ -536,8 +536,8 @@ namespace ts {
536
536
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
537
537
// to the one we would get for: { <...>(...): T }
538
538
//
539
- // We do that by making an anonymous type literal symbol, and then setting the function
540
- // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable
539
+ // We do that by making an anonymous type literal symbol, and then setting the function
540
+ // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable
541
541
// from an actual type literal symbol you would have gotten had you used the long form.
542
542
let symbol = createSymbol ( SymbolFlags . Signature , getDeclarationName ( node ) ) ;
543
543
addDeclarationToSymbol ( symbol , node , SymbolFlags . Signature ) ;
@@ -638,7 +638,7 @@ namespace ts {
638
638
}
639
639
640
640
function getStrictModeIdentifierMessage ( node : Node ) {
641
- // Provide specialized messages to help the user understand why we think they're in
641
+ // Provide specialized messages to help the user understand why we think they're in
642
642
// strict mode.
643
643
if ( getContainingClass ( node ) ) {
644
644
return Diagnostics . Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode ;
@@ -696,7 +696,7 @@ namespace ts {
696
696
}
697
697
698
698
function getStrictModeEvalOrArgumentsMessage ( node : Node ) {
699
- // Provide specialized messages to help the user understand why we think they're in
699
+ // Provide specialized messages to help the user understand why we think they're in
700
700
// strict mode.
701
701
if ( getContainingClass ( node ) ) {
702
702
return Diagnostics . Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode ;
@@ -760,24 +760,24 @@ namespace ts {
760
760
function bind ( node : Node ) {
761
761
node . parent = parent ;
762
762
763
- var savedInStrictMode = inStrictMode ;
763
+ let savedInStrictMode = inStrictMode ;
764
764
if ( ! savedInStrictMode ) {
765
765
updateStrictMode ( node ) ;
766
766
}
767
767
768
768
// First we bind declaration nodes to a symbol if possible. We'll both create a symbol
769
- // and then potentially add the symbol to an appropriate symbol table. Possible
769
+ // and then potentially add the symbol to an appropriate symbol table. Possible
770
770
// destination symbol tables are:
771
- //
771
+ //
772
772
// 1) The 'exports' table of the current container's symbol.
773
773
// 2) The 'members' table of the current container's symbol.
774
774
// 3) The 'locals' table of the current container.
775
775
//
776
- // However, not all symbols will end up in any of these tables. 'Anonymous' symbols
776
+ // However, not all symbols will end up in any of these tables. 'Anonymous' symbols
777
777
// (like TypeLiterals for example) will not be put in any table.
778
778
bindWorker ( node ) ;
779
779
780
- // Then we recurse into the children of the node to bind them as well. For certain
780
+ // Then we recurse into the children of the node to bind them as well. For certain
781
781
// symbols we do specialized work when we recurse. For example, we'll keep track of
782
782
// the current 'container' node when it changes. This helps us know which symbol table
783
783
// a local should go into for example.
@@ -817,7 +817,7 @@ namespace ts {
817
817
}
818
818
}
819
819
}
820
-
820
+
821
821
/// Should be called only on prologue directives (isPrologueDirective(node) should be true)
822
822
function isUseStrictPrologueDirective ( node : ExpressionStatement ) : boolean {
823
823
let nodeText = getTextOfNodeFromSourceText ( file . text , node . expression ) ;
@@ -972,9 +972,9 @@ namespace ts {
972
972
let symbol = node . symbol ;
973
973
974
974
// TypeScript 1.0 spec (April 2014): 8.4
975
- // Every class automatically contains a static property member named 'prototype', the
975
+ // Every class automatically contains a static property member named 'prototype', the
976
976
// type of which is an instantiation of the class type with type Any supplied as a type
977
- // argument for each type parameter. It is an error to explicitly declare a static
977
+ // argument for each type parameter. It is an error to explicitly declare a static
978
978
// property member with the name 'prototype'.
979
979
//
980
980
// Note: we check for this here because this class may be merging into a module. The
@@ -1000,7 +1000,7 @@ namespace ts {
1000
1000
1001
1001
function bindVariableDeclarationOrBindingElement ( node : VariableDeclaration | BindingElement ) {
1002
1002
if ( inStrictMode ) {
1003
- checkStrictModeEvalOrArguments ( node , node . name )
1003
+ checkStrictModeEvalOrArguments ( node , node . name ) ;
1004
1004
}
1005
1005
1006
1006
if ( ! isBindingPattern ( node . name ) ) {
@@ -1039,7 +1039,7 @@ namespace ts {
1039
1039
declareSymbolAndAddToSymbolTable ( node , SymbolFlags . FunctionScopedVariable , SymbolFlags . ParameterExcludes ) ;
1040
1040
}
1041
1041
1042
- // If this is a property-parameter, then also declare the property symbol into the
1042
+ // If this is a property-parameter, then also declare the property symbol into the
1043
1043
// containing class.
1044
1044
if ( node . flags & NodeFlags . AccessibilityModifier &&
1045
1045
node . parent . kind === SyntaxKind . Constructor &&
@@ -1056,4 +1056,4 @@ namespace ts {
1056
1056
: declareSymbolAndAddToSymbolTable ( node , symbolFlags , symbolExcludes ) ;
1057
1057
}
1058
1058
}
1059
- }
1059
+ }
0 commit comments