Clean up comment more.

This commit is contained in:
Cyrus Najmabadi 2015-04-20 23:56:38 -07:00
parent 93b7c33347
commit fac9ab2508

View File

@ -349,18 +349,21 @@ module ts {
case SyntaxKind.Block:
// do not treat blocks directly inside a function as a block-scoped-container.
// that reside in this block should go to the function locals. Otherwise this
// wouldn't be considered as redeclaration of a block scoped local:
// that reside in this block should go to the function locals. Othewise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
// example:
//
// function foo() {
// var x;
// let x;
// }
//
// If we placed 'var x' into the function locals and 'let x' - into the locals of
// the block, then there would be no collision. By not creating a new block-
// scoped-container here, we ensure that both 'var x' and 'let x' go into the
// Function - container's locals, and we do get a collision conflict.
// If we placed 'var x' into the function locals and 'let x' into the locals of
// the block, then there would be no collision.
//
// By not creating a new block-scoped-container here, we ensure that both 'var x'
// and 'let x' go into the Function-container's locals, and we do get a collision
// conflict.
return isFunctionLike(node.parent) ? ContainerFlags.None : ContainerFlags.IsBlockScopedContainer;
}