diff --git a/test/language/statements/for-await-of/dstr-const-ary-init-iter-close.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-init-iter-close.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js index 0cdcd7e4fc..1039a28bab 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-init-iter-close.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-init-iter-close.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Iterator is closed when not exhausted by pattern evaluation (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-init-iter-no-close.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-init-iter-no-close.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js index 0e022a7e6a..05934a53a7 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-init-iter-no-close.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-init-iter-no-close.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Iterator is not closed when exhausted by pattern evaluation (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-name-iter-val.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-name-iter-val.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js index c3e9393b59..21e7e1b867 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-name-iter-val.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-name-iter-val.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding with normal value iteration (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elem-init.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elem-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js index 38ba6617e6..16be9ff47e 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elem-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elem-iter.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elem-iter.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js index 502dc0ea11..1d0248f454 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elem-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elision-init.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elision-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js index 95e972500d..27125e719c 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elision-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elision-iter.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elision-iter.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js index 5917a8434b..10bb68aef7 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-elision-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-empty-init.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-empty-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js index a4f88149da..9b47d7a905 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-empty-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-empty-iter.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-empty-iter.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js index 7ac1759172..22596321c4 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-empty-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-rest-init.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-rest-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js index 158dc4badc..cca37884a6 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-rest-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-rest-iter.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-rest-iter.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js index eaa606d290..50b802cbfa 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-ary-rest-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js index 13d7a9c059..6388341fa4 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Destructuring initializer with an exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js index acdfe55ecf..2f9f653e5f 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding does assign name to arrow functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-class.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js index cf6a3e92bf..ae1c89b290 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-class.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js index 723dbda526..cc2e149ac9 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js index b5bc52d472..ec2b84d22a 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js index 0589c024bc..bf12902974 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-hole.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-hole.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js index ef022dc7ad..938816b7cd 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-hole.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-hole.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Destructuring initializer with a "hole" (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js index 1663684dff..568cdf2f22 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-undef.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-undef.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js index 94a40e8564..1e545ce147 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-init-undef.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-undef.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Destructuring initializer with an undefined value (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-complete.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-complete.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js index 3f7bbbbfc0..0ff192d53a 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-complete.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding when value iteration completes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-done.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-done.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js index 3ccfb5370c..049e63251a 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-done.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-done.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding when value iteration was completed previously (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-val.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-val.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js index 5ee3f98f2a..2ccdfe9261 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-id-iter-val.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-val.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding when value iteration was completed previously (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-id-init.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js index 1748831f89..37c94784d4 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-id-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with object binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js index ed6c4c51cd..eba2c68c33 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-prop-id-init.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-prop-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js index 33543c42e5..b1e0c0aff6 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-prop-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with object binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js index f0b2612674..c582aeb953 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elem-obj-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elision-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elision-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js index 090dd4c908..8ed43c30f6 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elision-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elision-exhausted.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Elision accepts exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elision.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-elision.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js index b88a7fafa5..e7c4abd2f8 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elision.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Elision advances iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-empty.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-empty.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js index 1a28eed4ff..51878e73de 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-empty.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: No iteration occurs for an "empty" array binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-elem.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-elem.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js index c0d24ba05e..cce4949f23 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-elem.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-elem.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element containing an array BindingElementList pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-elision.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-elision.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js index fc9f361301..6c0808323c 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-elision.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element containing an elision (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-empty.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-empty.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js index b266f8c1ac..8ea667514b 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-empty.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element containing an "empty" array pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-rest.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-rest.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js index a268c26d48..5f1b66864d 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-ary-rest.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-rest.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element containing a rest element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id-elision.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id-elision.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js index 5c642a14a5..9bba9ceb10 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id-elision.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element following elision elements (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js index c61d284ae2..4a498c65db 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id-exhausted.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: RestElement applied to an exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js index 2b7a894190..d24261dc12 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Lone rest element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-ary.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-ary.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js index e576efe55d..85f5a8519d 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-ary.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Reset element (nested array pattern) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js index 1d9a0d2e47..bf9fb83298 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Reset element (identifier) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-obj.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-obj.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js index f22b3fd561..dd7ba69805 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-init-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-obj.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Reset element (nested object pattern) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-ary.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-ary.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js index 67a80bb5cd..f73c4d25fc 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-ary.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element (array binding pattern) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js index 23e2aad643..a8a0f59bf3 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element (identifier) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-obj.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-obj.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js index d8a224f8f7..b31b55d38d 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-not-final-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-obj.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element (object binding pattern) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-obj-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-obj-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js index 35d5174885..14e59f0e24 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-obj-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-obj-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element containing an object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-obj-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-obj-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js index 9070c7875e..862dd2c06a 100644 --- a/test/language/statements/for-await-of/dstr-const-ary-ptrn-rest-obj-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest element containing an object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-empty.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-empty.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js index 159c097a55..62bc00e91b 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-empty.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: No property access occurs for an "empty" object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-arrow.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js index 3ac3212bdb..99088f3545 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-arrow.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns `name` to arrow functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-class.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js index 66b8e5998e..f7c7c82c26 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-class.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-cover.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js index 364d03b370..2c5fd7d73b 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-cover.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-fn.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js index 375c2431ee..760dd3eacd 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-fn.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-gen.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js index d30692d012..a66ab304dc 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-fn-name-gen.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js index 33bf5847e1..409293ed96 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-id-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js index 26b8147d90..54209dcf2c 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-id-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-trailing-comma.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary-init.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js index 24325bf2c8..5e779f8a83 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Object binding pattern with "nested" array binding pattern using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js index 5832e641fc..299000840e 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js index 70d919d4b6..30d6faa24f 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Object binding pattern with "nested" array binding pattern not using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js similarity index 97% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js index 9ff7cf81c8..804ce530cd 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-init.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js index 4d0b61013e..fc4df8f6a4 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Binding as specified via property name, identifier, and initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js index 9f95bacda7..241e45219e 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js index 3b0b5b860d..d22a15158a 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Binding as specified via property name and identifier (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-obj-init.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-obj-init.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js index 64dd06a2bc..a10efc4222 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-obj-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-obj-init.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Object binding pattern with "nested" object binding pattern using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-obj.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-obj.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js index 7ac86724b7..40e3e79b04 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-prop-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-obj.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Object binding pattern with "nested" object binding pattern not using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-getter.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-getter.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js index a288c610f5..efc8128d10 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-getter.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-getter.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-nested-obj.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-nested-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-nested-obj.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-nested-obj.js index 9db1fc10d5..a961f0a984 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-nested-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-nested-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-nested-obj.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-obj-nested-rest.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-obj-nested-rest.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-obj-nested-rest.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-obj-nested-rest.js index 16184659ee..112e6cefb9 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-obj-nested-rest.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-obj-nested-rest.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-obj-nested-rest.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment and object rest desconstruction is allowed in that case. (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-obj-own-property.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-obj-own-property.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-obj-own-property.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-obj-own-property.js index 31fd5f8595..f9b6490be4 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-obj-own-property.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-obj-own-property.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-obj-own-property.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest object contains just soruce object's own properties (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-skip-non-enumerable.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js index bee075b8d0..09c0f294fe 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-skip-non-enumerable.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest object doesn't contain non-enumerable properties (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-val-obj.js b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-val-obj.js rename to test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js index 1ddb8d01d9..d12dda7cd0 100644 --- a/test/language/statements/for-await-of/dstr-const-obj-ptrn-rest-val-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-val-obj.case -// - src/dstr-binding/default/for-await-of-const.template +// - src/dstr-binding/default/for-await-of-async-func-const.template /*--- description: Rest object contains just unextracted data (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-let-ary-init-iter-close.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-init-iter-close.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js index d3bc7e676e..65a17c851e 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-init-iter-close.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-init-iter-close.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Iterator is closed when not exhausted by pattern evaluation (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -68,6 +68,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-init-iter-no-close.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-init-iter-no-close.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js index 780078328b..fe3e33c70b 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-init-iter-no-close.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-init-iter-no-close.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Iterator is not closed when exhausted by pattern evaluation (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -68,6 +68,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-name-iter-val.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-name-iter-val.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js index 29f3d5d4c7..686979fa0b 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-name-iter-val.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-name-iter-val.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding with normal value iteration (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -67,6 +67,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elem-init.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elem-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js index a796fe5b33..1c3773d58d 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elem-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elem-iter.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elem-iter.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js index d909bf2ea5..b5b2746ad9 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elem-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -60,6 +60,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elision-init.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elision-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js index c59dadf52d..11732c8004 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elision-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -66,6 +66,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elision-iter.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elision-iter.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js index 511ea928b8..6be43c50f4 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-elision-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -63,6 +63,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-empty-init.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-empty-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js index a9529ac92a..7967b9e34d 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-empty-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -61,6 +61,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-empty-iter.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-empty-iter.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js index ff238e9b25..c9a1e71a0c 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-empty-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-rest-init.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-rest-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js index 7fb6991839..dd9054dc96 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-rest-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -63,6 +63,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-rest-iter.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-rest-iter.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js index c759223d08..4d97da5525 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-ary-rest-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -66,6 +66,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js index 8c017d3553..03609220d2 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Destructuring initializer with an exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -58,6 +58,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js index 18bbd62d9d..ad8c744c16 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding does assign name to arrow functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-class.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js index 587debe48d..e67a7b1f38 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-class.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -61,6 +61,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js index 07fb4a8bff..446d4ccbd1 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -60,6 +60,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js index f367c0a3e7..47d1d07614 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -60,6 +60,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js index e577679d93..48e27656d6 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -60,6 +60,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-hole.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-hole.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js index e8dbc858bc..6dc9674a0e 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-hole.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-hole.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Destructuring initializer with a "hole" (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js index 2294e7e657..0e91fb032c 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -63,6 +63,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-undef.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-undef.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js index f4b17d0e2a..3961d10cde 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-init-undef.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-undef.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Destructuring initializer with an undefined value (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -57,6 +57,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-complete.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-complete.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js index 7ad43e8ff8..7733415ac6 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-complete.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding when value iteration completes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -61,6 +61,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-done.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-done.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js index 4ed38c0b63..ad1d3aeb9b 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-done.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-done.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding when value iteration was completed previously (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -56,6 +56,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-val.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-val.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js index be5214f633..f32886c008 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-id-iter-val.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-val.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding when value iteration was completed previously (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -67,6 +67,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-id-init.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js index c6e3b192fe..260ce8e0cb 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-id-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with object binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js index 2c9648b92a..31893cc7e9 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-prop-id-init.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-prop-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js index 1a7369dda3..d2d584edea 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-prop-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with object binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -69,6 +69,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js index a02dcb859f..570cd6cc1a 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elem-obj-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -69,6 +69,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elision-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elision-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js index 3bb106af88..077aa7036c 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elision-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elision-exhausted.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Elision accepts exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -64,6 +64,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elision.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-elision.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js index 2c762c81ed..b54efb1c50 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elision.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Elision advances iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -73,6 +73,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-empty.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-empty.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js index db5621fae6..1ad42240dc 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-empty.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: No iteration occurs for an "empty" array binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -56,6 +56,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-elem.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-elem.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js index 0b9fe75145..1b565c77c5 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-elem.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-elem.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element containing an array BindingElementList pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -80,6 +80,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-elision.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-elision.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js index d83f6ce3b1..efadfd8685 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-elision.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element containing an elision (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -86,6 +86,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-empty.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-empty.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js index e6c16d797a..57545f9c02 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-empty.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element containing an "empty" array pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -69,6 +69,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-rest.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-rest.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js index 1f108ef5f5..90392ac3e7 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-ary-rest.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-rest.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element containing a rest element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -65,6 +65,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id-elision.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id-elision.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js index a5dbcf4f22..305439c8e1 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id-elision.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element following elision elements (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -61,6 +61,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js index b079deb33a..04376d28d7 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id-exhausted.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: RestElement applied to an exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -57,6 +57,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js index a80b553869..23237699d8 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Lone rest element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -58,6 +58,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-ary.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-ary.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js index 4c55b2a0cc..b0bd6fad16 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-ary.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Reset element (nested array pattern) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js index cadd61f289..513a53549d 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Reset element (identifier) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-obj.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-obj.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js index 59778af65a..aafad9ef7e 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-init-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-obj.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Reset element (nested object pattern) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-ary.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-ary.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js index bc8943cb26..271dd8ebf9 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-ary.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element (array binding pattern) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js index 23e75d31d3..f0693f856f 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element (identifier) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-obj.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-obj.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js index 2a3103c1cb..61caced332 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-not-final-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-obj.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element (object binding pattern) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -54,6 +54,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-obj-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-obj-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js index d9c4170ca8..ec19f4c5e0 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-obj-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-obj-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element containing an object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -58,6 +58,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-obj-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-obj-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js index 989ecd1c93..b910e4c332 100644 --- a/test/language/statements/for-await-of/dstr-let-ary-ptrn-rest-obj-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest element containing an object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -66,6 +66,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-empty.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-empty.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js index 72ba298d84..0048005a4e 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-empty.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: No property access occurs for an "empty" object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -57,6 +57,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-arrow.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js index fbd3d2a997..be2ab64e07 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-arrow.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns `name` to arrow functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -58,6 +58,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-class.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js index f453a1e71d..ec3dcd5d0a 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-class.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -60,6 +60,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-cover.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js index 65153fcb20..a674642109 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-cover.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-fn.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js index 4f1d903ff0..5ee8ee9979 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-fn.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-gen.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js index 0a9a6a303c..eacf63dd09 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-fn-name-gen.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js index 9666799cf0..bebeb0d385 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -62,6 +62,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-id-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js index 4dc81382fd..b51e211dcf 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-id-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-trailing-comma.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -52,6 +52,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary-init.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js index 1a157b4afe..5a4968e084 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Object binding pattern with "nested" array binding pattern using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -61,6 +61,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js index 82111fe780..58af61065a 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -52,6 +52,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js index 978c19d6b2..0ce5ee2760 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Object binding pattern with "nested" array binding pattern not using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js similarity index 97% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js index 113cf71280..d691914286 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -74,6 +74,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-init.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js index b05bbc4ed5..80645ce537 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Binding as specified via property name, identifier, and initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -55,6 +55,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js index 5be32da2b2..0999eee055 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -56,6 +56,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js index 50997f5352..68e343c609 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Binding as specified via property name and identifier (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -55,6 +55,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-obj-init.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-obj-init.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js index 2f5397c385..a5daebc839 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-obj-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-obj-init.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Object binding pattern with "nested" object binding pattern using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -61,6 +61,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-obj.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-obj.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js index 46c3e0aa4c..dd0ec4ac43 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-prop-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-obj.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Object binding pattern with "nested" object binding pattern not using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-getter.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-getter.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js index 69fbb9e64f..5eeb1d4be9 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-getter.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-getter.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -53,6 +53,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-nested-obj.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-nested-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-nested-obj.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-nested-obj.js index d4b0f33fdf..b16d6ca5f6 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-nested-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-nested-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-nested-obj.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -50,6 +50,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-obj-nested-rest.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-obj-nested-rest.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-obj-nested-rest.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-obj-nested-rest.js index 8783dad661..4d884b02c4 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-obj-nested-rest.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-obj-nested-rest.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-obj-nested-rest.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment and object rest desconstruction is allowed in that case. (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -60,6 +60,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-obj-own-property.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-obj-own-property.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-obj-own-property.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-obj-own-property.js index 0c417b5f9d..9c6bb2a8a2 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-obj-own-property.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-obj-own-property.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-obj-own-property.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest object contains just soruce object's own properties (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -51,6 +51,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-skip-non-enumerable.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js index 90835219ce..5629ac0537 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-skip-non-enumerable.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest object doesn't contain non-enumerable properties (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -59,6 +59,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-val-obj.js b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-val-obj.js rename to test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js index c418f18f52..169ee01dc3 100644 --- a/test/language/statements/for-await-of/dstr-let-obj-ptrn-rest-val-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-val-obj.case -// - src/dstr-binding/default/for-await-of-let.template +// - src/dstr-binding/default/for-await-of-async-func-let.template /*--- description: Rest object contains just unextracted data (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation @@ -58,6 +58,7 @@ async function fn() { iterCount += 1; } } + fn() .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/dstr-var-ary-init-iter-close.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-init-iter-close.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js index 83f9d62556..42e0ea537b 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-init-iter-close.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-init-iter-close.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Iterator is closed when not exhausted by pattern evaluation (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-init-iter-no-close.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-init-iter-no-close.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js index 2db7ca1aa6..35a8571acc 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-init-iter-no-close.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-init-iter-no-close.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Iterator is not closed when exhausted by pattern evaluation (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-name-iter-val.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-name-iter-val.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js index e85f8c7e86..014c9318d1 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-name-iter-val.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-name-iter-val.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding with normal value iteration (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elem-init.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elem-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js index 1e89a5dac4..d5d5313685 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elem-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elem-iter.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elem-iter.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js index 10f190ffa4..114baede84 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elem-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elision-init.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elision-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js index b9950e5cb2..461be8bb6a 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elision-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elision-iter.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elision-iter.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js index 5469c56290..002f7e19da 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-elision-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-empty-init.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-empty-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js index 6004ceba87..01619e2c83 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-empty-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-empty-iter.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-empty-iter.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js index f2e74a17bd..f22768d953 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-empty-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-rest-init.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-rest-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js index 0287efdd56..b324d69cd1 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-rest-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-rest-iter.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-rest-iter.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js index cfbde9bed6..3e1919229d 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-ary-rest-iter.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js index 300332b093..06a19128ab 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Destructuring initializer with an exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js index 82bc9f2562..29de904b19 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding does assign name to arrow functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-class.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js index cc1ec30d42..ceec52ac8b 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-class.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js index 1504281049..33cac5c111 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js index 583140e4e4..c793a212bc 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js index b04fe71b5d..147492b25d 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-hole.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-hole.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js index b593841354..18ad11001e 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-hole.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-hole.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Destructuring initializer with a "hole" (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js index c6a6f37fc8..4be9d9e1ff 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-undef.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-undef.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js index 4a84ac0a91..d367cdb401 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-init-undef.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-undef.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Destructuring initializer with an undefined value (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-complete.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-complete.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js index 6d887beda4..9efc5a99f1 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-complete.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding when value iteration completes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-done.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-done.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js index 8c97c0ec1a..213374f332 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-done.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-done.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding when value iteration was completed previously (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-val.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-val.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js index 7c67a0c4f4..853ad53720 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-id-iter-val.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-iter-val.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding when value iteration was completed previously (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-id-init.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js index 6ce4e84c61..7f9ea083d5 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-id-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with object binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js index 0d5d04de7e..c55e46a4ee 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-prop-id-init.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-prop-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js index 27372cdf9d..519fb8c2bd 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-prop-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with object binding pattern and initializer is used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js index 4d9c70d2f2..53dc964213 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elem-obj-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elision-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elision-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js index cae0ba72df..1227067048 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elision-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elision-exhausted.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Elision accepts exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elision.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-elision.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js index aa36cecdad..eb8dd07ae2 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elision.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Elision advances iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-empty.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-empty.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js index f06399c280..a8dd317c50 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-empty.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: No iteration occurs for an "empty" array binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-elem.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-elem.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js index 55a2061f7e..d25d1758b0 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-elem.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-elem.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element containing an array BindingElementList pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-elision.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-elision.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js index 6709c68f02..04b011f03b 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-elision.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element containing an elision (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-empty.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-empty.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js index ad91032d34..b2d9df529c 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-empty.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element containing an "empty" array pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-rest.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-rest.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js index 278982149a..8abe632a90 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-ary-rest.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-ary-rest.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element containing a rest element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id-elision.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id-elision.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js index 9034397277..3341c8dedb 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id-elision.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id-elision.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element following elision elements (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id-exhausted.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id-exhausted.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js index 3f137a3b1d..a6e1c5066d 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id-exhausted.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id-exhausted.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: RestElement applied to an exhausted iterator (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js index dc61d9c858..a5c5f7263c 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Lone rest element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-ary.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-ary.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js index 373064f3e5..0a8ab48f56 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-ary.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Reset element (nested array pattern) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js index 62ea35ad70..229e5dc5f7 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Reset element (identifier) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-obj.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-obj.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js index 329f588bcb..5f6c7c0886 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-init-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-init-obj.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Reset element (nested object pattern) does not support initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-ary.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-ary.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js index 6fe23938a0..f62a7301ac 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-ary.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element (array binding pattern) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js index cd554a96e3..d084388e14 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element (identifier) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-obj.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-obj.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js index 7694f4dfff..7046450d1a 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-not-final-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-not-final-obj.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element (object binding pattern) may not be followed by any element (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-obj-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-obj-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js index 74ef0ae970..124af8cfbb 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-obj-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-obj-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element containing an object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-obj-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-obj-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js index f90232560d..bc7ae32b47 100644 --- a/test/language/statements/for-await-of/dstr-var-ary-ptrn-rest-obj-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest element containing an object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-empty.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-empty.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js index 016cad85aa..1a9f890298 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-empty.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-empty.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: No property access occurs for an "empty" object binding pattern (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-arrow.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js index 12d10444cf..44bbc40447 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-arrow.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns `name` to arrow functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-class.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js index 32cfb32fa6..fd17f68212 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-class.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-cover.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js index cd939d78bb..69f54d6485 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-cover.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-fn.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js index 4760fff9b4..2d5faa8ab5 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-fn.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-gen.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js index 2753014bc1..8cd86a1a4c 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-fn-name-gen.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js index 7390d76c63..dfc8e256e3 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js similarity index 95% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-id-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js index 78c420c14a..70de521cec 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-id-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-id-trailing-comma.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary-init.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js index be19e57908..11d0357b63 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Object binding pattern with "nested" array binding pattern using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js similarity index 95% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js index 372cdf5f4a..e39dab9586 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js index 327f4e20d0..818e1ed546 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-ary.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-ary.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Object binding pattern with "nested" array binding pattern not using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-init-skipped.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js similarity index 97% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-init-skipped.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js index ff715cb12e..009a0f872f 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-init-skipped.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-init.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js index 506e774d54..eb784bac85 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Binding as specified via property name, identifier, and initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-trailing-comma.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-trailing-comma.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js index 85de17cabc..ea4ac044e7 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id-trailing-comma.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js index 3c6327c90f..57014f7f74 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-id.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-id.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Binding as specified via property name and identifier (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-obj-init.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-obj-init.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js index 6646adb426..2f942a0547 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-obj-init.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-obj-init.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Object binding pattern with "nested" object binding pattern using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-obj.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-obj.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js index 2c3c0cea22..0899221246 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-prop-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-prop-obj.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Object binding pattern with "nested" object binding pattern not using initializer (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-getter.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-getter.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js index a052d41bd7..d87fd221df 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-getter.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-getter.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-nested-obj.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-nested-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-nested-obj.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-nested-obj.js index 869599f644..5301d26f8b 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-nested-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-nested-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-nested-obj.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-obj-nested-rest.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-obj-nested-rest.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-obj-nested-rest.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-obj-nested-rest.js index bb13ba95a5..941a73902e 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-obj-nested-rest.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-obj-nested-rest.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-obj-nested-rest.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment and object rest desconstruction is allowed in that case. (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-obj-own-property.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-obj-own-property.js similarity index 95% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-obj-own-property.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-obj-own-property.js index 753d9283f2..ba95beb993 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-obj-own-property.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-obj-own-property.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-obj-own-property.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest object contains just soruce object's own properties (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-skip-non-enumerable.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js index 152d00280a..1726337dba 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-skip-non-enumerable.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest object doesn't contain non-enumerable properties (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-val-obj.js b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js similarity index 96% rename from test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-val-obj.js rename to test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js index cc58bcca68..cf08fbf576 100644 --- a/test/language/statements/for-await-of/dstr-var-obj-ptrn-rest-val-obj.js +++ b/test/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js @@ -1,6 +1,6 @@ // This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-rest-val-obj.case -// - src/dstr-binding/default/for-await-of-var.template +// - src/dstr-binding/default/for-await-of-async-func-var.template /*--- description: Rest object contains just unextracted data (for-await-of statement) esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js new file mode 100644 index 0000000000..1497edf04e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var iterCount = 0; + +async function *fn() { + for await (const [x] of [iter]) { + assert.sameValue(doneCallCount, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js new file mode 100644 index 0000000000..cf4a39abcc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var iterCount = 0; + +async function *fn() { + for await (const [x] of [iter]) { + assert.sameValue(doneCallCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js new file mode 100644 index 0000000000..3faf3cbfc6 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding with normal value iteration (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [x, y, z] of [[1, 2, 3]]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..67b68eeb60 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [[x, y, z] = [4, 5, 6]] of [[]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..4db8e598f9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [[x, y, z] = [4, 5, 6]] of [[[7, 8, 9]]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..dcf8ae8c5f --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (const [[,] = g()] of [[]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..1f9f4a1393 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (const [[,] = g()] of [[[]]]) { + assert.sameValue(callCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..278ef3d3bd --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var iterCount = 0; + +async function *fn() { + for await (const [[] = function() { initCount += 1; return iter; }()] of [[]]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..99f4bda258 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var iterCount = 0; + +async function *fn() { + for await (const [[] = function() { initCount += 1; }()] of [[[23]]]) { + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..e7cb6ccf5d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var iterCount = 0; + +async function *fn() { + for await (const [[...x] = values] of [[]]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..f61536370d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var iterCount = 0; + +async function *fn() { + for await (const [[...x] = function() { initCount += 1; }()] of [[values]]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..e5b1f948f3 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Destructuring initializer with an exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [x = 23] of [[]]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..9ada3f3c03 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding does assign name to arrow functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [arrow = () => {}] of [[]]) { + assert.sameValue(arrow.name, 'arrow'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..612aca5034 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of [[]]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..ecb228cce6 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [cover = (function () {}), xCover = (0, function() {})] of [[]]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..f98f040691 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [fn = function () {}, xFn = function x() {}] of [[]]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..784b48021f --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [gen = function* () {}, xGen = function* x() {}] of [[]]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..1765e419b3 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Destructuring initializer with a "hole" (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [x = 23] of [[,]]) { + assert.sameValue(x, 23); + // another statement + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..2a7f2df851 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (const [w = counter(), x = counter(), y = counter(), z = counter()] of [[null, 0, false, '']]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..dc8c934b6a --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Destructuring initializer with an undefined value (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [x = 23] of [[undefined]]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..d4351a5c3e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding when value iteration completes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [x] of [[]]) { + assert.sameValue(x, undefined); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..3fb492ffa5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding when value iteration was completed previously (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [_, x] of [[]]) { + assert.sameValue(x, undefined); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..b0bcc276b5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding when value iteration was completed previously (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [x, y, z] of [[1, 2, 3]]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..7a242fcd52 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with object binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] of [[]]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..15fb156e16 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] of [[{ x: 11, y: 22, z: 33 }]]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..5c7253f591 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with object binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of [[]]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..49c5aa6fbb --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of [[{ u: 777, w: 888, y: 999 }]]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..da676c9a64 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Elision accepts exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var iterCount = 0; + +async function *fn() { + for await (const [,] of [iter]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js new file mode 100644 index 0000000000..f4d2d223a3 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Elision advances iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (const [,] of [g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js new file mode 100644 index 0000000000..0a07095783 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var iterCount = 0; + +async function *fn() { + for await (const [] of [iter]) { + assert.sameValue(iterations, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..c90f480c04 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element containing an array BindingElementList pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...[x, y, z]] of [[3, 4, 5]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..66cdaf05e9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element containing an elision (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (const [...[,]] of [g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..02e25f9166 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element containing an "empty" array pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var iterCount = 0; + +async function *fn() { + for await (const [...[]] of [iter]) { + assert.sameValue(iterations, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..3fe466f7cc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element containing a rest element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var iterCount = 0; + +async function *fn() { + for await (const [...[...x]] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..90c91dd096 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element following elision elements (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var iterCount = 0; + +async function *fn() { + for await (const [ , , ...x] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..05b18f3770 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: RestElement applied to an exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [, , ...x] of [[1, 2]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..d4adb39dd7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Lone rest element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var iterCount = 0; + +async function *fn() { + for await (const [...x] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..f4557978ca --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Reset element (nested array pattern) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...[ x ] = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..b9851ce5a4 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Reset element (identifier) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...x = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..476c61cb7c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Reset element (nested object pattern) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...{ x } = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..008925ab24 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...[x], y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..086d8bd8ed --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element (identifier) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...x, y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..2d1b5c0f86 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...{ x }, y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..1d3709b675 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element containing an object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...{ length }] of [[1, 2, 3]]) { + assert.sameValue(length, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..c6bf5763c8 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest element containing an object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of [[7, 8, 9]]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.throws(ReferenceError, function() { + length; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js new file mode 100644 index 0000000000..2c35fe73c5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: No property access occurs for an "empty" object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var iterCount = 0; + +async function *fn() { + for await (const {} of [obj]) { + assert.sameValue(accessCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..52c60b8090 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { arrow = () => {} } of [{}]) { + assert.sameValue(arrow.name, 'arrow'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..224cb7309d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of [{}]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..1736107630 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { cover = (function () {}), xCover = (0, function() {}) } of [{}]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..6eb7ec6c99 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { fn = function () {}, xFn = function x() {} } of [{}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..908b19dfdc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { gen = function* () {}, xGen = function* x() {} } of [{}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..e9e47ec615 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (const { w = counter(), x = counter(), y = counter(), z = counter() } of [{ w: null, x: 0, y: false, z: '' }]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..222bb4e17d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { x, } of [{ x: 23 }]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..56992acf73 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { w: [x, y, z] = [4, 5, 6] } of [{}]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..cd33691e9a --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { x: [y], } of [{ x: [45] }]) { + assert.sameValue(y,45); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..aa0a1d2b5e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { w: [x, y, z] = [4, 5, 6] } of [{ w: [7, undefined, ] }]) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..6e30b4addd --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (const { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of [{ s: null, u: 0, w: false, y: '' }]) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..f115c1a00a --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Binding as specified via property name, identifier, and initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { x: y = 33 } of [{ }]) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..941a489d5d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { x: y, } of [{ x: 23 }]) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..887b3ffa8d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Binding as specified via property name and identifier (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { x: y } of [{ x: 23 }]) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..a8cc271ee5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: undefined }]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..000b5ee650 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: { x: undefined, z: 7 } }]) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..feb3ee672c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 count = 0; + +var iterCount = 0; + +async function *fn() { + for await (const {...x} of [{ get v() { count++; return 2; } }]) { + assert.sameValue(x.v, 2); + assert.sameValue(count, 1); + + verifyEnumerable(x, "v"); + verifyWritable(x, "v"); + verifyConfigurable(x, "v"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-nested-obj.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-nested-obj.js new file mode 100644 index 0000000000..0c9df0425d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-nested-obj.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-nested-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, 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 obj = {a: 3, b: 4}; + +var iterCount = 0; + +async function *fn() { + for await (const {a, b, ...{c, e}} of [{a: 1, b: 2, c: 3, d: 4, e: 5}]) { + assert.sameValue(a, 1); + assert.sameValue(b, 2); + assert.sameValue(c, 3); + assert.sameValue(e, 5); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-obj-nested-rest.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-obj-nested-rest.js new file mode 100644 index 0000000000..6cc56dd972 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-obj-nested-rest.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-obj-nested-rest.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment and object rest desconstruction is allowed in that case. (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 {a, b, ...{c, ...rest}} of [{a: 1, b: 2, c: 3, d: 4, e: 5}]) { + assert.sameValue(a, 1); + assert.sameValue(b, 2); + assert.sameValue(c, 3); + + assert.sameValue(rest.d, 4); + assert.sameValue(rest.e, 5); + + verifyEnumerable(rest, "d"); + verifyWritable(rest, "d"); + verifyConfigurable(rest, "d"); + + verifyEnumerable(rest, "e"); + verifyWritable(rest, "e"); + verifyConfigurable(rest, "e"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-obj-own-property.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-obj-own-property.js new file mode 100644 index 0000000000..5feda71cc0 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-obj-own-property.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-obj-own-property.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest object contains just soruce object's own properties (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 o = Object.create({ x: 1, y: 2 }); +o.z = 3; + +var iterCount = 0; + +async function *fn() { + for await (const { x, ...{y , z} } of [o]) { + assert.sameValue(x, 1); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..4f46ed6138 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest object doesn't contain non-enumerable properties (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var iterCount = 0; + +async function *fn() { + for await (const {...rest} of [o]) { + assert.sameValue(rest.a, 3); + assert.sameValue(rest.b, 4); + assert.sameValue(rest.x, undefined); + + verifyEnumerable(rest, "a"); + verifyWritable(rest, "a"); + verifyConfigurable(rest, "a"); + + verifyEnumerable(rest, "b"); + verifyWritable(rest, "b"); + verifyConfigurable(rest, "b"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..be2cfeb37e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-const.template +/*--- +description: Rest object contains just unextracted data (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) { + assert.sameValue(rest.x, 1); + assert.sameValue(rest.y, 2); + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyEnumerable(rest, "x"); + verifyWritable(rest, "x"); + verifyConfigurable(rest, "x"); + + verifyEnumerable(rest, "y"); + verifyWritable(rest, "y"); + verifyConfigurable(rest, "y"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js new file mode 100644 index 0000000000..e8c52641fc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var iterCount = 0; + +async function *fn() { + for await (let [x] of [iter]) { + assert.sameValue(doneCallCount, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js new file mode 100644 index 0000000000..f8a864f366 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var iterCount = 0; + +async function *fn() { + for await (let [x] of [iter]) { + assert.sameValue(doneCallCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js new file mode 100644 index 0000000000..68216f0984 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding with normal value iteration (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [x, y, z] of [[1, 2, 3]]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..0fef22fad7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [[x, y, z] = [4, 5, 6]] of [[]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..4ae7f9791b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [[x, y, z] = [4, 5, 6]] of [[[7, 8, 9]]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..f726b09b86 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (let [[,] = g()] of [[]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..326cdd3a25 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (let [[,] = g()] of [[[]]]) { + assert.sameValue(callCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..1209ad16b9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var iterCount = 0; + +async function *fn() { + for await (let [[] = function() { initCount += 1; return iter; }()] of [[]]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..4fcb04bc12 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var iterCount = 0; + +async function *fn() { + for await (let [[] = function() { initCount += 1; }()] of [[[23]]]) { + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..affcf80773 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var iterCount = 0; + +async function *fn() { + for await (let [[...x] = values] of [[]]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..fc92b995df --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var iterCount = 0; + +async function *fn() { + for await (let [[...x] = function() { initCount += 1; }()] of [[values]]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..be40de4690 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Destructuring initializer with an exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [x = 23] of [[]]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..056216857c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding does assign name to arrow functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [arrow = () => {}] of [[]]) { + assert.sameValue(arrow.name, 'arrow'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..0b94b1621c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of [[]]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..2306c9a64c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [cover = (function () {}), xCover = (0, function() {})] of [[]]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..41fcf4ce54 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [fn = function () {}, xFn = function x() {}] of [[]]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..2152268f97 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [gen = function* () {}, xGen = function* x() {}] of [[]]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..a87cde7b6c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Destructuring initializer with a "hole" (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [x = 23] of [[,]]) { + assert.sameValue(x, 23); + // another statement + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..6db1ecc754 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (let [w = counter(), x = counter(), y = counter(), z = counter()] of [[null, 0, false, '']]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..c8ff55d7ab --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Destructuring initializer with an undefined value (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [x = 23] of [[undefined]]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..b024c3d0c1 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding when value iteration completes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [x] of [[]]) { + assert.sameValue(x, undefined); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..d7412ff11f --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding when value iteration was completed previously (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [_, x] of [[]]) { + assert.sameValue(x, undefined); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..10d416d125 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding when value iteration was completed previously (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [x, y, z] of [[1, 2, 3]]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..dacb5ef6b2 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with object binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] of [[]]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..f07274a2eb --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] of [[{ x: 11, y: 22, z: 33 }]]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..d6efe0b405 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with object binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of [[]]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..ff8ca7c378 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of [[{ u: 777, w: 888, y: 999 }]]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..d617ba98b8 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Elision accepts exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var iterCount = 0; + +async function *fn() { + for await (let [,] of [iter]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js new file mode 100644 index 0000000000..d44fce93f9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Elision advances iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (let [,] of [g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js new file mode 100644 index 0000000000..814b9f4eaf --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var iterCount = 0; + +async function *fn() { + for await (let [] of [iter]) { + assert.sameValue(iterations, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..59e18c715d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element containing an array BindingElementList pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...[x, y, z]] of [[3, 4, 5]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..a0a93d5524 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element containing an elision (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (let [...[,]] of [g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..37c05ea3dd --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element containing an "empty" array pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var iterCount = 0; + +async function *fn() { + for await (let [...[]] of [iter]) { + assert.sameValue(iterations, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..db99932d55 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element containing a rest element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var iterCount = 0; + +async function *fn() { + for await (let [...[...x]] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..dfa4c70b93 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element following elision elements (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var iterCount = 0; + +async function *fn() { + for await (let [ , , ...x] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..027208c186 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: RestElement applied to an exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [, , ...x] of [[1, 2]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..ec4c32a717 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Lone rest element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var iterCount = 0; + +async function *fn() { + for await (let [...x] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..b2f08f80a6 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Reset element (nested array pattern) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...[ x ] = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..9da2bf376c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Reset element (identifier) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...x = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..235093cf31 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Reset element (nested object pattern) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...{ x } = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..4fba7a53b6 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...[x], y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..282bf725c9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element (identifier) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...x, y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..5e4ad34e57 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...{ x }, y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..5f7bce420b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element containing an object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...{ length }] of [[1, 2, 3]]) { + assert.sameValue(length, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..9b0f1d53f6 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest element containing an object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of [[7, 8, 9]]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.throws(ReferenceError, function() { + length; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js new file mode 100644 index 0000000000..588eba33ee --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: No property access occurs for an "empty" object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var iterCount = 0; + +async function *fn() { + for await (let {} of [obj]) { + assert.sameValue(accessCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..95e7c81029 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { arrow = () => {} } of [{}]) { + assert.sameValue(arrow.name, 'arrow'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..164ea6bfe3 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of [{}]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..2448a0823f --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { cover = (function () {}), xCover = (0, function() {}) } of [{}]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..a27096a57e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { fn = function () {}, xFn = function x() {} } of [{}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..84d7cad58d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { gen = function* () {}, xGen = function* x() {} } of [{}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..6cd193f1f1 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (let { w = counter(), x = counter(), y = counter(), z = counter() } of [{ w: null, x: 0, y: false, z: '' }]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..ba9f74a38d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { x, } of [{ x: 23 }]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..df9e45cb20 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { w: [x, y, z] = [4, 5, 6] } of [{}]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..e3d53a7cbc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { x: [y], } of [{ x: [45] }]) { + assert.sameValue(y,45); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..285a50c5c4 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { w: [x, y, z] = [4, 5, 6] } of [{ w: [7, undefined, ] }]) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..a60a4e2d7d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (let { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of [{ s: null, u: 0, w: false, y: '' }]) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..4f0e761139 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Binding as specified via property name, identifier, and initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { x: y = 33 } of [{ }]) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..6132cfab0b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { x: y, } of [{ x: 23 }]) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..7bc51f011b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Binding as specified via property name and identifier (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { x: y } of [{ x: 23 }]) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..093aa51e50 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: undefined }]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..fb6dc47ebb --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: { x: undefined, z: 7 } }]) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..d9cb4658fb --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 count = 0; + +var iterCount = 0; + +async function *fn() { + for await (let {...x} of [{ get v() { count++; return 2; } }]) { + assert.sameValue(x.v, 2); + assert.sameValue(count, 1); + + verifyEnumerable(x, "v"); + verifyWritable(x, "v"); + verifyConfigurable(x, "v"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-nested-obj.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-nested-obj.js new file mode 100644 index 0000000000..8bab27ff10 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-nested-obj.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-nested-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, 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 obj = {a: 3, b: 4}; + +var iterCount = 0; + +async function *fn() { + for await (let {a, b, ...{c, e}} of [{a: 1, b: 2, c: 3, d: 4, e: 5}]) { + assert.sameValue(a, 1); + assert.sameValue(b, 2); + assert.sameValue(c, 3); + assert.sameValue(e, 5); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-obj-nested-rest.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-obj-nested-rest.js new file mode 100644 index 0000000000..ae59a81fb5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-obj-nested-rest.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-obj-nested-rest.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment and object rest desconstruction is allowed in that case. (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 {a, b, ...{c, ...rest}} of [{a: 1, b: 2, c: 3, d: 4, e: 5}]) { + assert.sameValue(a, 1); + assert.sameValue(b, 2); + assert.sameValue(c, 3); + + assert.sameValue(rest.d, 4); + assert.sameValue(rest.e, 5); + + verifyEnumerable(rest, "d"); + verifyWritable(rest, "d"); + verifyConfigurable(rest, "d"); + + verifyEnumerable(rest, "e"); + verifyWritable(rest, "e"); + verifyConfigurable(rest, "e"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-obj-own-property.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-obj-own-property.js new file mode 100644 index 0000000000..d6744f3fc4 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-obj-own-property.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-obj-own-property.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest object contains just soruce object's own properties (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 o = Object.create({ x: 1, y: 2 }); +o.z = 3; + +var iterCount = 0; + +async function *fn() { + for await (let { x, ...{y , z} } of [o]) { + assert.sameValue(x, 1); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..47b59b5996 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest object doesn't contain non-enumerable properties (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var iterCount = 0; + +async function *fn() { + for await (let {...rest} of [o]) { + assert.sameValue(rest.a, 3); + assert.sameValue(rest.b, 4); + assert.sameValue(rest.x, undefined); + + verifyEnumerable(rest, "a"); + verifyWritable(rest, "a"); + verifyConfigurable(rest, "a"); + + verifyEnumerable(rest, "b"); + verifyWritable(rest, "b"); + verifyConfigurable(rest, "b"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..82d726781d --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-let.template +/*--- +description: Rest object contains just unextracted data (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) { + assert.sameValue(rest.x, 1); + assert.sameValue(rest.y, 2); + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyEnumerable(rest, "x"); + verifyWritable(rest, "x"); + verifyConfigurable(rest, "x"); + + verifyEnumerable(rest, "y"); + verifyWritable(rest, "y"); + verifyConfigurable(rest, "y"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js new file mode 100644 index 0000000000..a5874cc1a1 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var iterCount = 0; + +async function *fn() { + for await (var [x] of [iter]) { + assert.sameValue(doneCallCount, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js new file mode 100644 index 0000000000..48593cfb3b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var iterCount = 0; + +async function *fn() { + for await (var [x] of [iter]) { + assert.sameValue(doneCallCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js new file mode 100644 index 0000000000..61e414c10c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding with normal value iteration (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [x, y, z] of [[1, 2, 3]]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..4b815f0e56 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [[x, y, z] = [4, 5, 6]] of [[]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..6e0ac0d6fc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [[x, y, z] = [4, 5, 6]] of [[[7, 8, 9]]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..8f4715e096 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (var [[,] = g()] of [[]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..26f0c311f7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (var [[,] = g()] of [[[]]]) { + assert.sameValue(callCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..6bce3a800b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var iterCount = 0; + +async function *fn() { + for await (var [[] = function() { initCount += 1; return iter; }()] of [[]]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..d3741ae991 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var iterCount = 0; + +async function *fn() { + for await (var [[] = function() { initCount += 1; }()] of [[[23]]]) { + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..a9172e5bac --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var iterCount = 0; + +async function *fn() { + for await (var [[...x] = values] of [[]]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..5bc056655c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var iterCount = 0; + +async function *fn() { + for await (var [[...x] = function() { initCount += 1; }()] of [[values]]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..2e75de8cc7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Destructuring initializer with an exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [x = 23] of [[]]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..7df8ba3d09 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding does assign name to arrow functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [arrow = () => {}] of [[]]) { + assert.sameValue(arrow.name, 'arrow'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..eb78e065fb --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of [[]]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..de1d8916e1 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [cover = (function () {}), xCover = (0, function() {})] of [[]]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..929fb7807e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [fn = function () {}, xFn = function x() {}] of [[]]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..f958fc26b7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [gen = function* () {}, xGen = function* x() {}] of [[]]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..45ce16b59b --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Destructuring initializer with a "hole" (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [x = 23] of [[,]]) { + assert.sameValue(x, 23); + // another statement + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..b30c5c865a --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (var [w = counter(), x = counter(), y = counter(), z = counter()] of [[null, 0, false, '']]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..7dda4302a2 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Destructuring initializer with an undefined value (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [x = 23] of [[undefined]]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..5f32291e77 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding when value iteration completes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [x] of [[]]) { + assert.sameValue(x, undefined); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..9b254f8eb9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding when value iteration was completed previously (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [_, x] of [[]]) { + assert.sameValue(x, undefined); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..ece50ed4bc --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding when value iteration was completed previously (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [x, y, z] of [[1, 2, 3]]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..8c004ca1a7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with object binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] of [[]]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..c0710ee115 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] of [[{ x: 11, y: 22, z: 33 }]]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..c30c39f6be --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with object binding pattern and initializer is used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of [[]]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..dc1286d58c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of [[{ u: 777, w: 888, y: 999 }]]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..6628e08b07 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Elision accepts exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var iterCount = 0; + +async function *fn() { + for await (var [,] of [iter]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js new file mode 100644 index 0000000000..f1f395f536 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Elision advances iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (var [,] of [g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js new file mode 100644 index 0000000000..18138e3439 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var iterCount = 0; + +async function *fn() { + for await (var [] of [iter]) { + assert.sameValue(iterations, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..ea5f3a4861 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element containing an array BindingElementList pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...[x, y, z]] of [[3, 4, 5]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..ec1cf79059 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element containing an elision (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var iterCount = 0; + +async function *fn() { + for await (var [...[,]] of [g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..01077a065a --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element containing an "empty" array pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [generators, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var iterCount = 0; + +async function *fn() { + for await (var [...[]] of [iter]) { + assert.sameValue(iterations, 1); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..d5cd2794cf --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element containing a rest element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var iterCount = 0; + +async function *fn() { + for await (var [...[...x]] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..86255849a5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element following elision elements (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var iterCount = 0; + +async function *fn() { + for await (var [ , , ...x] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..9b67445a4c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: RestElement applied to an exhausted iterator (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [Symbol.iterator, destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [, , ...x] of [[1, 2]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..94015c5690 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Lone rest element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var iterCount = 0; + +async function *fn() { + for await (var [...x] of [values]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..e7f0525075 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Reset element (nested array pattern) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...[ x ] = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..a719fd7d67 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Reset element (identifier) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...x = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..d0a57eca9c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Reset element (nested object pattern) does not support initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...{ x } = []] of [[]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..19dd7805b4 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...[x], y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..b321a3ec96 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element (identifier) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...x, y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..24825aa395 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, async] +negative: + phase: early + type: SyntaxError +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. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...{ x }, y] of [[1, 2, 3]]) { + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..e1c73b95a7 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element containing an object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...{ length }] of [[1, 2, 3]]) { + assert.sameValue(length, 3); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..c94993506e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest element containing an object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of [[7, 8, 9]]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.throws(ReferenceError, function() { + length; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js new file mode 100644 index 0000000000..9315800eff --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: No property access occurs for an "empty" object binding pattern (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var iterCount = 0; + +async function *fn() { + for await (var {} of [obj]) { + assert.sameValue(accessCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..294b35f833 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { arrow = () => {} } of [{}]) { + assert.sameValue(arrow.name, 'arrow'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..3fd837f8c6 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of [{}]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..2ccbd94270 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { cover = (function () {}), xCover = (0, function() {}) } of [{}]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..7d1e1c0a9a --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { fn = function () {}, xFn = function x() {} } of [{}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..af224a5f4e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { gen = function* () {}, xGen = function* x() {} } of [{}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..ff50196c9f --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (var { w = counter(), x = counter(), y = counter(), z = counter() } of [{ w: null, x: 0, y: false, z: '' }]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..5c7a5e6afa --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { x, } of [{ x: 23 }]) { + assert.sameValue(x, 23); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..af5ab32a44 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { w: [x, y, z] = [4, 5, 6] } of [{}]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..803325fef4 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { x: [y], } of [{ x: [45] }]) { + assert.sameValue(y,45); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..abe91d61a2 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { w: [x, y, z] = [4, 5, 6] } of [{ w: [7, undefined, ] }]) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..0ac07e7b57 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var iterCount = 0; + +async function *fn() { + for await (var { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of [{ s: null, u: 0, w: false, y: '' }]) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..6f8c5bf0f0 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Binding as specified via property name, identifier, and initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { x: y = 33 } of [{ }]) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..46f862dddf --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { x: y, } of [{ x: 23 }]) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..2afeaa7bfa --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Binding as specified via property name and identifier (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { x: y } of [{ x: 23 }]) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..a9bac0b5d9 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: undefined }]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..a9e4922af5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [destructuring-binding, async-iteration] +flags: [generated, 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. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var iterCount = 0; + +async function *fn() { + for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: { x: undefined, z: 7 } }]) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..3fa8e997d5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 count = 0; + +var iterCount = 0; + +async function *fn() { + for await (var {...x} of [{ get v() { count++; return 2; } }]) { + assert.sameValue(x.v, 2); + assert.sameValue(count, 1); + + verifyEnumerable(x, "v"); + verifyWritable(x, "v"); + verifyConfigurable(x, "v"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-nested-obj.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-nested-obj.js new file mode 100644 index 0000000000..c254232662 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-nested-obj.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-nested-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, 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 obj = {a: 3, b: 4}; + +var iterCount = 0; + +async function *fn() { + for await (var {a, b, ...{c, e}} of [{a: 1, b: 2, c: 3, d: 4, e: 5}]) { + assert.sameValue(a, 1); + assert.sameValue(b, 2); + assert.sameValue(c, 3); + assert.sameValue(e, 5); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-obj-nested-rest.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-obj-nested-rest.js new file mode 100644 index 0000000000..fcca42d70c --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-obj-nested-rest.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-obj-nested-rest.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment and object rest desconstruction is allowed in that case. (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 {a, b, ...{c, ...rest}} of [{a: 1, b: 2, c: 3, d: 4, e: 5}]) { + assert.sameValue(a, 1); + assert.sameValue(b, 2); + assert.sameValue(c, 3); + + assert.sameValue(rest.d, 4); + assert.sameValue(rest.e, 5); + + verifyEnumerable(rest, "d"); + verifyWritable(rest, "d"); + verifyConfigurable(rest, "d"); + + verifyEnumerable(rest, "e"); + verifyWritable(rest, "e"); + verifyConfigurable(rest, "e"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-obj-own-property.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-obj-own-property.js new file mode 100644 index 0000000000..94c115d95e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-obj-own-property.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-obj-own-property.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest object contains just soruce object's own properties (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 o = Object.create({ x: 1, y: 2 }); +o.z = 3; + +var iterCount = 0; + +async function *fn() { + for await (var { x, ...{y , z} } of [o]) { + assert.sameValue(x, 1); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..fbed5903f5 --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest object doesn't contain non-enumerable properties (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var iterCount = 0; + +async function *fn() { + for await (var {...rest} of [o]) { + assert.sameValue(rest.a, 3); + assert.sameValue(rest.b, 4); + assert.sameValue(rest.x, undefined); + + verifyEnumerable(rest, "a"); + verifyWritable(rest, "a"); + verifyConfigurable(rest, "a"); + + verifyEnumerable(rest, "b"); + verifyWritable(rest, "b"); + verifyConfigurable(rest, "b"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); + diff --git a/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..4fc93c481e --- /dev/null +++ b/test/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/for-await-of-async-gen-var.template +/*--- +description: Rest object contains just unextracted data (for-await-of statement) +esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation +features: [object-rest, destructuring-binding, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +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 {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) { + assert.sameValue(rest.x, 1); + assert.sameValue(rest.y, 2); + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyEnumerable(rest, "x"); + verifyWritable(rest, "x"); + verifyConfigurable(rest, "x"); + + verifyEnumerable(rest, "y"); + verifyWritable(rest, "y"); + verifyConfigurable(rest, "y"); + + + iterCount += 1; + } +} + +fn().next() + .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE) + .then($DONE, $DONE); +