@@ -173,6 +173,14 @@ namespace ts {
173173 return node . name ? declarationNameToString ( node . name ) : getDeclarationName ( node ) ;
174174 }
175175
176+ /**
177+ * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names.
178+ * @param symbolTable - The symbol table which node will be added to.
179+ * @param parent - node's parent declaration.
180+ * @param node - The declaration to be added to the symbol table
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.
183+ */
176184 function declareSymbol ( symbolTable : SymbolTable , parent : Symbol , node : Declaration , includes : SymbolFlags , excludes : SymbolFlags ) : Symbol {
177185 Debug . assert ( ! hasDynamicName ( node ) ) ;
178186
@@ -181,10 +189,11 @@ namespace ts {
181189
182190 let symbol : Symbol ;
183191 if ( name !== undefined ) {
192+
184193 // Check and see if the symbol table already has a symbol with this name. If not,
185194 // create a new symbol with this name and add it to the table. Note that we don't
186195 // give the new symbol any flags *yet*. This ensures that it will not conflict
187- // witht he 'excludes' flags we pass in.
196+ // with the 'excludes' flags we pass in.
188197 //
189198 // If we do get an existing symbol, see if it conflicts with the new symbol we're
190199 // creating. For example, a 'var' symbol and a 'class' symbol will conflict within
@@ -202,10 +211,10 @@ namespace ts {
202211 symbol = hasProperty ( symbolTable , name )
203212 ? symbolTable [ name ]
204213 : ( symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ) ;
205-
214+
206215 if ( name && ( includes & SymbolFlags . Classifiable ) ) {
207- classifiableNames [ name ] = name ;
208- }
216+ classifiableNames [ name ] = name ;
217+ }
209218
210219 if ( symbol . flags & excludes ) {
211220 if ( node . name ) {
@@ -314,6 +323,7 @@ namespace ts {
314323
315324 addToContainerChain ( container ) ;
316325 }
326+
317327 else if ( containerFlags & ContainerFlags . IsBlockScopedContainer ) {
318328 blockScopeContainer = node ;
319329 blockScopeContainer . locals = undefined ;
0 commit comments