diff --git a/src/dstr-binding/default/for-await-of-const.template b/src/dstr-binding/default/for-await-of-async-func-const.template similarity index 95% rename from src/dstr-binding/default/for-await-of-const.template rename to src/dstr-binding/default/for-await-of-async-func-const.template index f0d90221acecc569f911e56741cdb1582d8919a5..36a27da7848a50bd2cdc51ebb50493460b2f4096 100644 --- a/src/dstr-binding/default/for-await-of-const.template +++ b/src/dstr-binding/default/for-await-of-async-func-const.template @@ -1,7 +1,7 @@ // Copyright (C) 2017 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/for-await-of/dstr-const- +path: language/statements/for-await-of/async-func-dstr-const- name: for-await-of statement esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation features: [destructuring-binding, async-iteration] diff --git a/src/dstr-binding/default/for-await-of-let.template b/src/dstr-binding/default/for-await-of-async-func-let.template similarity index 96% rename from src/dstr-binding/default/for-await-of-let.template rename to src/dstr-binding/default/for-await-of-async-func-let.template index 3fe5f1600b073765d575151fb523b7152b1d7e13..69d3a3c5c08cf7cca839a5bd631c827e6f29654e 100644 --- a/src/dstr-binding/default/for-await-of-let.template +++ b/src/dstr-binding/default/for-await-of-async-func-let.template @@ -1,7 +1,7 @@ // Copyright (C) 2017 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/for-await-of/dstr-let- +path: language/statements/for-await-of/async-func-dstr-let- name: for-await-of statement esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation features: [destructuring-binding, async-iteration] @@ -45,6 +45,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/src/dstr-binding/default/for-await-of-var.template b/src/dstr-binding/default/for-await-of-async-func-var.template similarity index 95% rename from src/dstr-binding/default/for-await-of-var.template rename to src/dstr-binding/default/for-await-of-async-func-var.template index 7c97d614c1c9504844435a2cf8a06676e3f7ed32..eea5e60af59922b638f4a388182093994ec7a861 100644 --- a/src/dstr-binding/default/for-await-of-var.template +++ b/src/dstr-binding/default/for-await-of-async-func-var.template @@ -1,7 +1,7 @@ // Copyright (C) 2017 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -path: language/statements/for-await-of/dstr-var- +path: language/statements/for-await-of/async-func-dstr-var- name: for-await-of statement esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation features: [destructuring-binding, async-iteration] diff --git a/src/dstr-binding/default/for-await-of-async-gen-const.template b/src/dstr-binding/default/for-await-of-async-gen-const.template new file mode 100644 index 0000000000000000000000000000000000000000..c3891e7814483aa130e69eac5493126e4f9889e0 --- /dev/null +++ b/src/dstr-binding/default/for-await-of-async-gen-const.template @@ -0,0 +1,51 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/for-await-of/async-gen-dstr-const- +name: for-await-of statement +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [async] +info: | + IterationStatement : + for await ( ForDeclaration of AssignmentExpression ) Statement + + [...] + 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult, + lexicalBinding, labelSet, async). + + 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation + + [...] + 3. Let destructuring be IsDestructuring of lhs. + [...] + 5. Repeat + [...] + h. If destructuring is false, then + [...] + i. Else + i. If lhsKind is assignment, then + [...] + ii. Else if lhsKind is varBinding, then + [...] + iii. Else, + 1. Assert: lhsKind is lexicalBinding. + 2. Assert: lhs is a ForDeclaration. + 3. Let status be the result of performing BindingInitialization + for lhs passing nextValue and iterationEnv as arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const /*{ elems }*/ of [/*{ vals }*/]) { + /*{ body }*/ + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/src/dstr-binding/default/for-await-of-async-gen-let.template b/src/dstr-binding/default/for-await-of-async-gen-let.template new file mode 100644 index 0000000000000000000000000000000000000000..8a78365b0bd9a157da65beaae28ba4a5153032fa --- /dev/null +++ b/src/dstr-binding/default/for-await-of-async-gen-let.template @@ -0,0 +1,52 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/for-await-of/async-gen-dstr-let- +name: for-await-of statement +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [async] +info: | + IterationStatement : + for await ( ForDeclaration of AssignmentExpression ) Statement + + [...] + 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult, + lexicalBinding, labelSet, async). + + 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation + + [...] + 3. Let destructuring be IsDestructuring of lhs. + [...] + 5. Repeat + [...] + h. If destructuring is false, then + [...] + i. Else + i. If lhsKind is assignment, then + [...] + ii. Else if lhsKind is varBinding, then + [...] + iii. Else, + 1. Assert: lhsKind is lexicalBinding. + 2. Assert: lhs is a ForDeclaration. + 3. Let status be the result of performing BindingInitialization + for lhs passing nextValue and iterationEnv as arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let /*{ elems }*/ of [/*{ vals }*/]) { + /*{ body }*/ + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/src/dstr-binding/default/for-await-of-async-gen-var.template b/src/dstr-binding/default/for-await-of-async-gen-var.template new file mode 100644 index 0000000000000000000000000000000000000000..06e3d52b68e76e52ecb5d25895b928496218943c --- /dev/null +++ b/src/dstr-binding/default/for-await-of-async-gen-var.template @@ -0,0 +1,49 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/for-await-of/async-gen-dstr-var- +name: for-await-of statement +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [async] +info: | + IterationStatement : + for await ( var ForBinding of AssignmentExpression ) Statement + + [...] + 2. Return ? ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult, + varBinding, labelSet, async). + + 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation + + [...] + 3. Let destructuring be IsDestructuring of lhs. + [...] + 5. Repeat + [...] + h. If destructuring is false, then + [...] + i. Else + i. If lhsKind is assignment, then + [...] + ii. Else if lhsKind is varBinding, then + 1. Assert: lhs is a ForBinding. + 2. Let status be the result of performing BindingInitialization + for lhs passing nextValue and undefined as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var /*{ elems }*/ of [/*{ vals }*/]) { + /*{ body }*/ + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); +