Merge pull request #7902 from Microsoft/blockScopedBindingsInForOf
enable generated names for block-scoped binding in for-of
This commit is contained in:
commit
1317d23a8a
1 changed files with 3 additions and 0 deletions
|
@ -1567,6 +1567,9 @@ namespace ts {
|
||||||
// var v = _a[_i];
|
// var v = _a[_i];
|
||||||
if (isVariableDeclarationList(initializer)) {
|
if (isVariableDeclarationList(initializer)) {
|
||||||
const firstDeclaration = firstOrUndefined(initializer.declarations);
|
const firstDeclaration = firstOrUndefined(initializer.declarations);
|
||||||
|
if (initializer.flags & NodeFlags.BlockScoped) {
|
||||||
|
enableSubstitutionsForBlockScopedBindings();
|
||||||
|
}
|
||||||
if (firstDeclaration && isBindingPattern(firstDeclaration.name)) {
|
if (firstDeclaration && isBindingPattern(firstDeclaration.name)) {
|
||||||
// This works whether the declaration is a var, let, or const.
|
// This works whether the declaration is a var, let, or const.
|
||||||
// It will use rhsIterationValue _a[_i] as the initializer.
|
// It will use rhsIterationValue _a[_i] as the initializer.
|
||||||
|
|
Loading…
Reference in a new issue