enable generated names for block-scoped binding in for-of

This commit is contained in:
Vladimir Matveev 2016-04-06 15:40:17 -07:00
parent 39c877a7f9
commit f325a98f0e

View file

@ -1564,6 +1564,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.