Merge pull request #7902 from Microsoft/blockScopedBindingsInForOf

enable generated names for block-scoped binding in for-of
This commit is contained in:
Vladimir Matveev 2016-04-06 21:14:43 -07:00
commit 1317d23a8a

View file

@ -1567,6 +1567,9 @@ namespace ts {
// var v = _a[_i];
if (isVariableDeclarationList(initializer)) {
const firstDeclaration = firstOrUndefined(initializer.declarations);
if (initializer.flags & NodeFlags.BlockScoped) {
enableSubstitutionsForBlockScopedBindings();
}
if (firstDeclaration && isBindingPattern(firstDeclaration.name)) {
// This works whether the declaration is a var, let, or const.
// It will use rhsIterationValue _a[_i] as the initializer.